PHP code example of truecastdesign / mailchimp
1. Go to this page and download the library: Download truecastdesign/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/ */
truecastdesign / mailchimp example snippets
# composer autoloader
uecast\MailChimp('kl32j4kl23jklj4l23j4kl23j34-us14');
$member = ['first_name'=>'John', 'last_name'=>'Doe', 'email'=>'[email protected]'];
try {
$MailChimp->add($member, 'listid123456', 'pending'); # member array, list id, status
# success
# display a notice or take them somewhere
} catch (\Exception $ex) {
# failed
trigger_error("We were not able to add you to our list. Error: ".$ex->getMessage(), 256);
}