PHP code example of mjp91 / mailchimp-api-wrapper
1. Go to this page and download the library: Download mjp91/mailchimp-api-wrapper 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/ */
mjp91 / mailchimp-api-wrapper example snippets
// construct the request handler, passing in data centre, username and API key
$requestHandler = new \MailChimp\RequestHandler("us14", "[email protected]", "abc123");
// construct the request class for the API call, passing in any ssociative array
try {
$response = $requestHandler->handle($subscriberGet);
// $response->getHTTPCode();
// $response->getResponseBody();
} catch (RequestFailureException $ex) {
// a HTTP code returned indicating failure will cause an exception
$httpCode = $ex->getResponse()->getHttpCode();
$response = $ex->getResponse()->getResponseBody();
}