I was searching for a good PHP5 class, one without PHP4 support. One that use cURL. With this API I wanted to give users the chance to decide in wich format they want their results and support some basic methods and the more advanced are possible with the custom query.
<?php
include('mailchimp.php');
// set the API-key
Mailchimp::setApikey('API-key'); // change 'API-key' with yours
// set the default return format
// default is set to Mailchimp::JSON
Mailchimp::setFormat(Mailchimp::PHP);
$params = array(
'method' => 'listSubscribe',
'id' => '*******',
'email_address' => 'example@example.com',
'merge_vars' => array(
'FIRSTNAME' => 'My firstname',
'LASTNAME' => 'My lastname',
),
'updating_existing' => TRUE,
);
$results = Mailchimp::makeCall($params);
?>
<?php
include('flickr.php');
$result = Mailchimp::makeCall(array(
'method' => 'listSubscribe',
'id' => 'a65f016aa1',
'email_address' => $params['email'],
'merge_vars' => array(
'FIRSTNAME' => $params['firstname'],
'LASTNAME' => $params['lastname'],
),
'updating_existing' => TRUE,
));
$params = array(
'apikey' => 'API-key',
'output' => Mailchimp::XML,
'method' => 'listSubscribe',
'id' => '*********',
'email_address' => 'myemail@example.com',
'merge_vars' => array(
'FIRSTNAME' => 'my firstname',
'LASTNAME' => 'my lastname',
),
'updating_existing' => TRUE,
);
$results = Mailchimp::makeCall($params);
?>
If you find one, please inform us with the issue tracker on github.
Mailchimp 0.5.1 - 02/05/2010
- [bug] deleted CURLOPT_FOLLOWLOCATION that causes errors on shared webhosting
Mailchimp 0.5 - 13/04/2010
- Initial version of the PHP-wrapper without documentation
If you want something to add on this plugin, feel free to fork the project on github or add an issue as a feature request.
This plugin has a BSD License. You can find the license in license.txt that is included with class-package