Another Input could not be converted to a valid request


I’m trying to insert a contact via CURL.
I’ve got a returned message : Input could not be converted to a valid request

$nom_fichier_log =“log_infusionsoft_”.date(“Ymd”).“_”.date(“His”).“.txt”;
$data = array(“duplicate_option” => “Email”, “email_adresses” => array(array(“email”=>“”,“field”=>“EMAIL1”)));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“Accept:application/json, /
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “PUT”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$responsecode = $info[‘http_code’];
$final_result = json_decode($result, TRUE);
fwrite($fp_log, “Résultat : “.print_r($final_result, true).”\n”);

I’ve looked at the other messages. I checked double quotes.

When I add : $parameters = json_encode($data, true); and so send $parameters in CURL_POSTFIELDS
I have this message : Unrecognized property: duplicate_option

What am I missing ?
Best Regards

bumping to top due to accidental spam flag

Restart with the sample json. That error message means that, while modifying the json, it was corrupted in it’s format somehow. Make small changes until you get the message again so you can determine where it went wrong.


I’ve waited more help. I 've sent this message beacause I’ve tried several and sevral times, looked at many messages on Internet.

Best Regards

Your cURL call must contain JSON data and you’re trying to pass an array in $data which won’t work. Follow the formats in documentation and you should be ok!/Contact/createContactUsingPOST