file_get_contents()适用于某些网站但不适用于其他网站

时间:2015-08-14 04:46:59

标签: php wordpress http-headers external file-get-contents

我有3个网站坐在同一个网络服务器上。我正在使用我的WAMP localhost中的file_get_contents从这3个wordpress网站做一些时髦的编码,但是这个功能在3个中的1个上不起作用,它返回false,这意味着它无法得到任何东西。但疯狂地直接访问网址时工作。这是get_headers()的输出,如果这有帮助的话,注意第一个是不同的。任何帮助将不胜感激!

Array
(
    [0] => HTTP/1.1 200 OK
    [1] => Server: nginx
    [2] => Date: Fri, 14 Aug 2015 04:37:21 GMT
    [3] => Content-Type: text/html; charset=UTF-8
    [4] => Connection: close
    [5] => X-Pingback: http://armidaleplumber.com.au/wp/xmlrpc.php
    [6] => Link: ; rel=shortlink
    [7] => Set-Cookie: nf_wp_session=812a895bc4008d398bf10c61bbdc5dc7%7C%7C1439570241%7C%7C1439568441; expires=Fri, 14-Aug-2015 16:37:21 GMT; path=/
    [8] => X-Powered-By: PleskLin
)


Array
(
    [0] => HTTP/1.1 200 OK
    [1] => Server: nginx
    [2] => Date: Fri, 14 Aug 2015 04:37:22 GMT
    [3] => Content-Type: text/html; charset=UTF-8
    [4] => Connection: close
    [5] => Expires: Thu, 19 Nov 1981 08:52:00 GMT
    [6] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    [7] => Pragma: no-cache
    [8] => X-Pingback: http://armidalebuilder.com.au/wp/xmlrpc.php
    [9] => Link: ; rel=shortlink
    [10] => Set-Cookie: PHPSESSID=q515dll808qtabnr1v6s4a1sn1; path=/
    [11] => X-Powered-By: PleskLin
)


Array
(
    [0] => HTTP/1.1 200 OK
    [1] => Server: nginx
    [2] => Date: Fri, 14 Aug 2015 04:37:23 GMT
    [3] => Content-Type: text/html; charset=UTF-8
    [4] => Connection: close
    [5] => Expires: Thu, 19 Nov 1981 08:52:00 GMT
    [6] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    [7] => Pragma: no-cache
    [8] => X-Pingback: http://armidaleelectrician.com.au/wp/xmlrpc.php
    [9] => Link: ; rel=shortlink
    [10] => Set-Cookie: PHPSESSID=0m9afhknr7c0ijiso51j6264s7; path=/
    [11] => X-Powered-By: PleskLin
)

0 个答案:

没有答案