我有一个脚本正试图从Mailchimp中提取列表。提供此列表的URL是:
https://us8.api.mailchimp.com/1.3/?output=php&method=lists&apikey=XXXXXHIDDENKEYXXXXX-us8
通过直接访问链接,将显示列表的序列化数组。问题是当我使用PHP提取此信息时:
$response = "";
fwrite($sock, $payload);
stream_set_timeout($sock, $this->timeout);
$info = stream_get_meta_data($sock);
while ((!feof($sock)) && (!$info["timed_out"])) {
$response .= fread($sock, $this->chunkSize);
$info = stream_get_meta_data($sock);
}
fclose($sock);
ob_end_clean();
打印$response
变量后,将得到以下输出:
HTTP/1.0 302 Moved Temporarily
Server: AkamaiGHost
Content-Length: 0
Location: https://us8.api.mailchimp.com/1.3/?output=php&method=lists&apikey=XXXXXHIDDENKEYXXXXX-us8
Date: Thu, 23 Aug 2018 16:33:55 GMT
Connection: close
这是指向我用来尝试建立连接的MCAPI库的链接:
https://github.com/jbrooksuk/MCAPI-PHP
为什么当直接访问链接时却可以通过PHP阻止此信息?