【发布时间】:2015-03-30 19:41:29
【问题描述】:
我试图将订阅者的记录保存到 php 中的邮件黑猩猩,但我收到了这个我不明白的错误:
fsockopen(): php_network_getaddresses: getaddrinfo failed: No such host is known.
我正在使用 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);
}
谢谢
【问题讨论】:
-
如果那是您真正的 API 密钥,您可能希望将其从代码示例中删除,并出于安全考虑,生成一个新密钥。
-
@Shervin 不,这不是我真正的 API 密钥,谢谢您的建议 :)