• Resolved aliggrant

    (@aliggrant)


    Hi,
    Please could you let me know how you would mod the following code in order to post a request using your plugin? Could this be done with the free version of would a paid version be required?

    Many thanks in advance.

    $api_key = 'xxxxxxxxxxxxxxxxx';
    $req_body = array(
    	'model' => "blog-ideas",
    	'tone' => "friendly",
    	'creativity' => "regular",
    	'topic' => "German Vintage Cars",
    	'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);
    
    *************************************

    Instructions for the post request below.

    The API key has to be sent in headers as an Authorization Bearer Token

    Values should be sent as one json string
    The API url is: https://api.copymatic.ai
    All requests have to be sent as POST and from a valid website, requests coming from local hosts or any other local machine are not allowed.
    Always include your API key in HTTPHEADER or your requests will fail.

    • This topic was modified 2 years, 8 months ago by aliggrant.
    • This topic was modified 2 years, 8 months ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Help with Code’ is closed to new replies.