Mailchimpリスト 要求を動作していないAPIを使用してメンバーを追加します。[リストmemeber] cURLの機能していないリストmailchimp APIのメンバーを追加します:
$apikey = '#####################-us15';
$data = array(
'email_address' => '[email protected]',
'status' => 'subscribed',
'merge_fields' => array(
'FNAME' => 'taiabur rahman'
)
);
$json_data = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://us2.api.mailchimp.com/3.0/lists/6de91c2e1c/members/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array("content-type: application/json"));
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_USERPWD, "apikey:" . $apikey);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
$response_string = curl_exec($ch);
$curl_info = curl_getinfo($ch);
$curl_errno = curl_errno($ch);
$curl_error = curl_error($ch);
curl_close($ch);
echo '<pre>';
print_r($response_string);
die('Mailchimp executed');
:提供されるAPIキーが異なるデータセンター(403状態)にリンクされています応答: { "タイプ": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/"、 "タイトル": "間違ったデータセンター"、 "ステータス":403、 "詳細": "異なるデータセンターにリンクされて提供されるAPIキー"、 「インスタンス":" " }