我试图将订阅者的记录保存到php中发送黑猩猩,但是我得到了一个我不明白的错误:
fsockopen():php_network_getaddresses: getaddrinfo失败:不知道这样的主机.
我使用的是MCAPI类1.3版本
下面是我要保存的代码:
$apikey='d9750fc48519551e22e789c1gthy050a5-fd7'; // Enter your API key
$api = new MCAPI($apikey);
$retval = $api->lists();
$listid='d395e7afr4'; // Enter list Id here
$fname = $this->stepdata['yourName'];
$lname = $this->stepdata['yourName'];
$email = $this->stepdata['yourEmail'];
// By default this sends a confirmation email - you will not see new members
// until the link contained in it is clicked!
$merge_vars = array('FNAME' => $fname, 'LNAME' => $lname, 'EMAIL' => $email);
//listSubscribe'=>array("id","email_address","merge_vars","email_type","double_optin","update_existing","replace_interests","send_welcome")
if($api->listSubscribe($listid, $email, $merge_vars, $email_type='html', $double_optin=false, $update_existing=false, $replace_interests=false, $send_welcome=true ) === true) {
}这就是错误指向MCAPI类的地方。
ob_start();
if ($this->secure){
$sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
} else {
$sock = fsockopen($host, 80, $errno, $errstr, 30);
}谢谢
发布于 2015-03-31 02:38:27
如果这是一个真正的API密钥,那么您肯定应该禁用API密钥并生成一个新的API密钥,但在这种情况下,这实际上有助于回答这个问题。
MailChimp库使用API键的第二部分来确定要连接到哪个数据中心。在本例中,库将将其解释为‘fd7 7’,并尝试连接到fd7.api.mailchimp.com,后者不是有效的MailChimp数据中心。
我将从仪表板中重新复制您的API键,并确保最后一部分看起来像'usX‘,其中X是介于1-10之间的某个数字。
https://stackoverflow.com/questions/29354835
复制相似问题