Vanilla is a product of Lussumo. More Information: Documentation, Community Support.
//initialize variable values
$apiToken = ""; //your api token value
$personId = 80212; //the id of the person you are updating
//create the xml file to PUT
$putString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$putString .= "<person>\n";
$putString .= "<firstname>John</firstname>\n";
$putString .= "<lastname>Reeve</lastname>\n";
$putString .= "</person>\n";
//write the put string to a temp file, since curl PUT has to read from a file
$putData = tmpfile();
fwrite($putData, $putString);
fseek($putData, 0);
//intialize and send the curl request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://{$api_url}/person/$personId");
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $apiToken . ":");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Content-type: application/xml"));
curl_setopt($ch, CURLOPT_INFILE, $putData);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($putString));
$response = curl_exec($ch);
curl_close($ch);
//close out the temp file
fclose($putData);
1 to 5 of 5