DALL-E TestMichael Shawn McCabe2023-10-06T22:24:26+00:00 $prompt,
'max_tokens' => 100
));
// cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL and get the response
$response = curl_exec($ch);
// Close cURL
curl_close($ch);
// Decode response
$data = json_decode($response, true);
// Return the image URL (modify this according to the actual API response)
echo esc_url($data['image_url']);
exit;
}
?>