$ch = curl_init();
$id='';
$name="apikey";
$password="api secret";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://track.customer.io/api/v1/customers/'.$id);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Basic ".base64_encode("$name:$password")
]);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
if($data) {
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
}
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "PUT");
$result = curl_exec($ch);
curl_close($ch);
return $result;
function add_events_people($customer_name,$data) {
$ch = curl_init();
$name="apikey";
$password="api secret";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://track.customer.io/api/v1/customers/'.$customer_name.'/events');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Basic ".base64_encode("$name:$password")
]);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
if($data) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
}
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
$result = curl_exec($ch);
curl_close($ch);
return $result;
}