| Server IP : 80.211.21.168 / Your IP : 216.73.217.33 Web Server : Apache System : Linux alex-webdesign.it 3.10.0-1160.119.1.el7.tuxcare.els22.x86_64 #1 SMP Mon Aug 18 06:07:12 UTC 2025 x86_64 User : admin_japan ( 10003) PHP Version : 8.2.32 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/cerchijapan.it/ilpolonerd.it/urez/ |
Upload File : |
<?php
$apiKey = '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';
$model = 'gpt-4-turbo-preview'; // Aggiorna con l'identificativo corretto del modello, se necessario
// Prepara i dati per la richiesta
$data = [
'model' => $model,
'messages' => [
['role' => 'user', 'content' => 'Genera una descrizione per il seguente prodotto servirà per il mio ecommerce "Il Polo Nerd": One Piece – Portrait.Of.Pirates - "Playback Memories”: Nefertari Vivi appartentente alla categoria Action Figures e Statuette, Scrivimi la descrizione con i tag html da <h2> non usare Titolo: o cose di questo tipo. Crea una descrizione ricca ma concisa non devi inventare nulla ma descrivere al meglio il prodotto']
],
];
// Inizializza cURL
$ch = curl_init('https://api.openai.com/v1/chat/completions');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
"Authorization: Bearer $apiKey"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Esegui la richiesta
$response = curl_exec($ch);
curl_close($ch);
// Decodifica e gestisci la risposta
$responseData = json_decode($response, true);
if (!isset($responseData['error'])) {
foreach ($responseData['choices'] as $choice) {
if (isset($choice['message']['content'])) {
// echo $choice['message']['content'];
}
}
} else {
echo "Errore: " . $responseData['error']['message'];
}
$descrizioneLungag=$choice['message']['content'];
$data = [
'model' => $model,
'messages' => [
['role' => 'user', 'content' => 'Genera una descrizione BREVE per il seguente prodotto servirà per il mio ecommerce "Il Polo Nerd": One Piece – Portrait.Of.Pirates - "Playback Memories”: Nefertari Vivi appartentente alla categoria Action Figures e Statuette, ']
],
];
// Inizializza cURL
$ch = curl_init('https://api.openai.com/v1/chat/completions');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
"Authorization: Bearer $apiKey"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Esegui la richiesta
$response = curl_exec($ch);
curl_close($ch);
// Decodifica e gestisci la risposta
$responseData = json_decode($response, true);
if (!isset($responseData['error'])) {
foreach ($responseData['choices'] as $choice) {
if (isset($choice['message']['content'])) {
// echo $choice['message']['content'];
}
}
} else {
echo "Errore: " . $responseData['error']['message'];
}
$descrizioneBreveg=$choice['message']['content'];
echo $descrizioneBreveg;
echo $descrizioneLungag;
?>