Hello,
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”;
$fp_log=fopen($nom_fichier_log,“w”);
$data = array(“duplicate_option” => “Email”, “email_adresses” => array(array(“email”=>“test@test.fr”,“field”=>“EMAIL1”)));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “https://api.infusionsoft.com/crm/rest/v1/contacts?access_token=xxxxxx”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“content-type:application/json;charset=UTF-8”,
“Accept:application/json, /”
));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “PUT”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$responsecode = $info[‘http_code’];
$final_result = json_decode($result, TRUE);
fwrite($fp_log, “Résultat : “.print_r($final_result, true).”\n”);
fclose($fp_log);
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