【发布时间】:2016-09-27 04:07:26
【问题描述】:
我遇到了一个问题,我想不通。 我想使用 file_get_contents 或 curl 从我的其他站点获取数据,我首先验证文件是否存在于其他服务器上,但我收到 404 错误,即文件不存在,即使服务器上存在文件。
$fileBlue = 'http://theblueish.com/file.txt'; // File on my other server
echo 'Url is: '.$fileBlue.'<br>';
$file_headers = get_headers($fileBlue);
print_r($file_headers);
输出
Url is: http://theblueish.com/file.txt
Array ( [0] => HTTP/1.1 404 Not Found [1] => Date: Sun, 29 May 2016 06:13:38 GMT [2] => Server: Apache [3] => Content-Length: 325 [4] => Connection: close [5] => Content-Type: text/html; charset=iso-8859-1 )
当我尝试在线 HTTP 标头检查站点时,它返回 200 OK http://www.webconfs.com/http-header-check.php
请帮助我解决服务器给我 404 错误的原因。谢谢
【问题讨论】:
-
它对我有用。我得到 200 好的响应。可能是权限/php.ini 的东西。你能发布你的 phpinfo();输出?
-
这里是phpinfo theblueish.com/phpinfo.php
标签: php apache curl http-headers http-status-code-404