분류
php
mailchimp api with curl
본문
$apikey='xxxxxxxxxxxxx';
$listid='1234567890';
$auth = base64_encode( 'user:'.$apikey );
$data = array(
'apikey' => $apikey,
'email_address' => $_REQUEST['EMAIL'],
'status' => 'subscribed',
'double_optin' => false,
'send_welcome'=>false,
);
$json_data = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://us12.api.mailchimp.com/3.0/lists/'.$listid.'/members/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
'Authorization: Basic '.$auth));
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
$result = curl_exec($ch);
- 이전글.htaccess | Block one or more IP address 18.06.10
- 다음글이미지 업로드 18.06.10