PHP Api request example

Example code to unsubscribe user through API.
Change the authorization header value and the email address and it should work automatically.


$email='[email protected]';
$data = array(
"isSubscribed" => false,
"isSubscribedAlerts" => false
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.vtcdn.net/v1/user/".$email."",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"content-type: application/json",
"authorization: sssssa48AM",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

Related Articles