I am using PHP's CURL function to return all unsubscribed emails in my domain using MailGun. I tried the following code:
function get_unsubscriptions() {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'api:key-[key removed]');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_URL, 'https://api.mailgun.net/v3/[domain removed]/unsubscriptions');
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
But it only returns the following:
Mailgun Magnificent API
What am I doing wrong?