try
{
// create a new cURL resource
$ch = curl_init();
// Email
$Email = "Email To Unsubscribe";
$EngineMailerApiPath = "https://api.enginemailer.com/restapi/subscriber/emsubscriber/unSubSubscriber?email=" . $Email;
// Add APIKey into the Headers to be passed in.
$apiKey = "API Key Here";
$headers =["APIKey:".$apiKey];
$options = array(CURLOPT_URL => $EngineMailerApiPath,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => $headers
);
curl_setopt_array($ch, $options);
// Calls the Rest API
$respone = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
echo $respone;
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}