本文介绍了MailChimp API 2.0批量订阅PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法在MailChimp中订阅多封电子邮件.使用API https://bitbucket.org/mailchimp/mailchimp-api-php/downloads
I am not able to subscribe multiple emails in MailChimp. Using API https://bitbucket.org/mailchimp/mailchimp-api-php/downloads
$api_key = "***";
$list_id = "***";
require ('api/Mailchimp.php');
$Mailchimp = new Mailchimp($api_key);
$Mailchimp_Lists = new Mailchimp_Lists($Mailchimp);
$batch[] = array('email' => '[email protected]');
$batch[] = array('email' => '[email protected]');
$subscriber = $Mailchimp_Lists -> batchSubscribe($list_id, $batch, false, false, true);
我遇到以下错误:
[errors] => Array
(
[0] => Array
(
[code] => -99
[error] => An email address must contain a single @
[email] => [email protected]
)
[0] => Array
(
[code] => -99
[error] => An email address must contain a single @
[email] => [email protected]
)
)
推荐答案
电子邮件应该是结构,而不是字符串.
Email should be a struct, not a string.
$batch[] = array('email' => '[email protected]');
$batch[] = array('email' => '[email protected]');
应该是
$batch[] = array('email' => array('email' => '[email protected]'));
$batch[] = array('email' => array('email' => '[email protected]'));
这篇关于MailChimp API 2.0批量订阅PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!