Last active
June 28, 2017 02:13
-
-
Save DZuz14/380454b5ad2d862c521ab09289903842 to your computer and use it in GitHub Desktop.
Mailchimp API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$MailChimp = new MailChimp('insert api key here'); | |
$list_id = 'gmj87s22'; // Mailchimp List Id | |
$email = $_POST['email']; | |
$first_name = $_POST['firstName']; | |
$last_name = $_POST['lastName']; | |
$result = $MailChimp->post("lists/$list_id/members", [ | |
'email_address' => $email, | |
'merge_fields' => [ | |
'FNAME' => $first_name, | |
'LNAME' => $last_name | |
], | |
'status' => 'subscribed' | |
]); | |
if ($MailChimp->success()) { | |
echo 'Thanks for signing up. Your submittal was successful.'; | |
} else { | |
echo 'Something went wrong. You may already be subscribed.'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment