Q: MailChimp Unsubscribe in PHP I am having a terrible time trying to sort out unsubscribe from MailChimp via PHP.
I'm using mailchimp-api-php link to repo
I haven't been able to track down any examples of unsubscribe code, but using the API and the php code in the wrapper provided, I've put this together, which seems correct to me:
$unsub = $Mailchimp_Lists->unsubscribe(
    $list_id,
    $email,
    true, //delete_member
    true, //send_goodbye
    false //send_notify
);

The PHP error I now get is:
Uncaught exception 'Mailchimp_List_MergeFieldRequired' with message 'FNAME must be provided - Please enter a value.

Nowhere in the API docs does it mention needing or even a place to include FNAME in the unsubscribe function. I'm just lost here and desperately hoping somebody can light the way.

A: Have a look at their documentation, here: https://bitbucket.org/mailchimp/mailchimp-api-php/src/7ac99b5ac746d5875c5c350ad7e3b83674c83ec1/src/Mailchimp/Lists.php?at=master#cl-747 - the unsubscribe method expects the second parameter to be an array with an email key. Write your code like this:
$unsub = $Mailchimp_Lists->unsubscribe(
    $list_id,
    array('email' => $email),
    true, //delete_member
    true, //send_goodbye
    false //send_notify
);

