Title: Help with Code
Last modified: July 2, 2022

---

# Help with Code

 *  Resolved [aliggrant](https://wordpress.org/support/users/aliggrant/)
 * (@aliggrant)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/help-with-code-24/)
 * 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](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 3 years, 11 months ago by [aliggrant](https://wordpress.org/support/users/aliggrant/).
    -  This topic was modified 3 years, 11 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/help-with-code-24/#post-15793023)
 * Hi,
 * the free JCI-Plugin can’t handle that.
    Ask at [https://jsoncontentimporter.freshdesk.com/widgets/feedback_widget/new?searchArea=no](https://jsoncontentimporter.freshdesk.com/widgets/feedback_widget/new?searchArea=no)
   for ways to do that…
 * Bernhard

Viewing 1 replies (of 1 total)

The topic ‘Help with Code’ is closed to new replies.

 * ![](https://ps.w.org/json-content-importer/assets/icon-256x256.png?rev=3464653)
 * [Get Use APIs - JSON Content Importer](https://wordpress.org/plugins/json-content-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-content-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-content-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/json-content-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-content-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-content-importer/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [berkux](https://wordpress.org/support/users/berkux/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/help-with-code-24/#post-15793023)
 * Status: resolved