I've just read the following on the MailChimp website:
MailChimp API v3.0 is now live! Prior versions will no longer be supported after 2016, so all API users should begin transitioning to v3.0.
As a result, I would like to move to v3.0 of the API. Please could I have a function, in PHP, that returns a boolean, that will check whether an email address is subscribed to a specific MailChimp list. I do not want to subscribe that user, but merely check whether they are subscribed or not.
If you use the mailchimp-api it looks like that
include 'Mailchimp.php';
use \DrewM\MailChimp\MailChimp;
$MailChimp = new MailChimp('your**api***key');
function emailExistsMc($subscriberMail, $list_id){
global $MailChimp;
$subscriber_hash = $MailChimp->subscriberHash($subscriberMail);
$result = $MailChimp->get("lists/$list_id/members/$subscriber_hash");
if($result['status'] == '404') return false;
return true;
}
If $result['status']
is 404
then the resource was not found. Other possible values for $result['status']
are stated in the docs: