This is a basic PHP wrapper for the MailChimp API V3 for subscribe/unsubscribe to/from lists.
Subscribe
$mc = new \Oneup\MailChimp\Client('thisShouldBeYourApiKeyFromMailChimp-us1');
$response = $mc->subscribeToList(
'ea06b81001', // List ID
'[email protected]', // E-Mail address
[ // Array with first/lastname (MailChimp merge tags)
'FNAME' => 'Foo',
'LNAME' => 'Bar',
],
true // Double opt-in true
);
Unsubscribe
$mc = new \Oneup\MailChimp\Client('thisShouldBeYourApiKeyFromMailChimp-us1');
$response = $mc->unsubscribeFromList('yourListId', '[email protected]');