1. Go to this page and download the library: Download lorddashme/php-mailchimp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lorddashme / php-mailchimp example snippets
ordDashMe\MailChimp\MailChimp;
$apiKey = 'abcde12345...';
$mailchimp = new MailChimp($apiKey);
$listId = 'qwerty12345...';
$mailchimp->post("list/{$listId}/members", function ($requestBody) {
$requestBody->email_address = '[email protected]';
return $requestBody;
});
// If you want to investigate the current request details.
$mailchimp->getRequest();
// To get the response from the MailChimp API service.
// Response: {"response_body": {...}", "header": {"response_http_code": ...}}
$response = $mailchimp->getResponse();