make money with your profession

<?php

$topic = $_POST['topic'];
$api_key = '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';
$url = 'https://api.openai.com/v1/chat/completions';
$data = [
    'model' => 'gpt-4', // Change to the correct GPT-4 model name
    'messages' => [
        ['role' => 'system', 'content' => 'Provide a BuzzFeed-like article with solutions on making money with AI in the field of ' . $topic . '.'],
    ]
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $api_key,
    'Content-Type: application/json',
]);

$response = curl_exec($ch);

echo "Raw Response: ";
echo $response;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}

curl_close($ch);

$response_data = json_decode($response, true);
$article = $response_data['choices'][0]['message']['content'];

echo "Article: ";
echo $article;
?>