我想通过mailchimp api订阅带有一个或两个标签的电子邮件。
$authToken = 'xxx';
$list_id = 'xxx';
$postData = array(
"email_address" => "$email",
"status" => "subscribed", //subscribed -> direkt eintragen, pending mit double opt in
"merge_fields" => array(
"tag" => "tag_eins")
);
// Setup cURL
$ch = curl_init('https://us19.api.mailchimp.com/3.0/lists/'.$list_id.'/members/');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Authorization: apikey '.$authToken,
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($postData)
));
$response = curl_exec($ch);
除了标签之外,其他方法都可以正常工作。列表中存在标签“ tag_eins”。 感谢您的帮助。