Created
October 24, 2016 06:40
-
-
Save AshikNesin/96a406b684f6b7de653cee83680a51dd to your computer and use it in GitHub Desktop.
MailChimp Single Optin
This file contains hidden or 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 | |
// error_reporting(E_ALL); | |
// ini_set('display_errors', 1); | |
// switch ($_SERVER['HTTP_ORIGIN']) { | |
// case 'http://www.ios.buyselltickets.in': case 'http://ios.buyselltickets.in': | |
// header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']); | |
// header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); | |
// header('Access-Control-Max-Age: 1000'); | |
// header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With'); | |
// break; | |
// } | |
include('./src/MailChimp.php'); | |
use \DrewM\MailChimp\MailChimp; | |
$MailChimp = new MailChimp('API_KEY'); | |
$list_id = 'LIST_ID'; | |
$email_id = $_POST["EMAIL"]; | |
$result = $MailChimp->post("lists/$list_id/members", [ | |
'email_address' => $email_id, | |
'status' => 'subscribed', | |
]); | |
echo json_encode($result); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment