Skip to content

Instantly share code, notes, and snippets.

@aabir
Created February 29, 2016 13:09
Show Gist options
  • Select an option

  • Save aabir/44fa0400a31b008c6ec7 to your computer and use it in GitHub Desktop.

Select an option

Save aabir/44fa0400a31b008c6ec7 to your computer and use it in GitHub Desktop.
$merge_vars=array(
'FNAME'=>'Aabir',
);
$email = '[email protected]';
$send_data=array(
'email'=>array('email'=>$email),
'apikey'=>"", //API KEY
'id'=>"", //List ID
'merge_vars'=>$merge_vars,
'double_optin'=>false,
'update_existing'=>true,
'replace_interests'=>false,
'send_welcome'=>false,
'email_type'=>"html",
);
$payload=json_encode($send_data);
$submit_url="https://us12.api.mailchimp.com/2.0/lists/subscribe.json";
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$submit_url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$payload);
$result=curl_exec($ch);
curl_close($ch);
$mcdata=json_decode($result);
var_dump($mcdata);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment