$api_key = 'xxxxxxxxxxxxxxxxx'; $req_body = array( 'model' => "blog-ideas", 'tone' => "friendly", 'creativity' => "regular", 'topic' => "A blog article about an AI article generator.", 'language'=> "English (US)" ); $postfields = json_encode($req_body); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.copymatic.ai", CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $postfields, CURLOPT_AUTOREFERER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer '.$api_key ] ]); $r = curl_exec($curl); $err = curl_error($curl); curl_close($curl);