【发布时间】:2015-02-05 12:39:50
【问题描述】:
所以正如标题所说,我得到 - file_get_contents 上的 HTTP/1.1 500 Internal Server Error 这是错误日志-
! ) Warning: file_get_contents(http://thepilotslife.com/assets/chat-output.php): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\wamp\www\test\index.php on line 3
http://thepilotslife.com/assets/chat-output.php 的 URL 在 borwser 中打开良好,尝试打开自己,尝试每 5 秒在浏览器中重新加载 URL,您不会每次输出都不同,所以我基本上需要从该 URL 获取数据然后对其执行某些任务。这是php文件内容-
<?php
$baseurl = "http://thepilotslife.com/assets/chat-output.php";
$response = file_get_contents($baseurl);
echo $response;
?>
我也尝试通过以下方式使用 CURL
<?
$url = "http://thepilotslife.com/assets/chat-output.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo $curl_scraped_page;
?>
上面的 CURL 代码没有给出任何错误,但它每次只给我一个空白页。我在 CURL 代码中也使用了 var_dump,它显示字符串每次都是空的。 我也用谷歌搜索并尝试了其他解决方案,但都没有奏效。
编辑: 对于某些人来说,即使在浏览器上链接也会出错,但对我来说工作正常,所以这里是链接图片供参考 http://i.stack.imgur.com/VM09P.png
另请注意,file_get_contents 和 CURL 与其他链接完美配合
【问题讨论】:
-
The URL http://thepilotslife.com/assets/chat-output.php opens well in borwser, try opening yourself,刚刚尝试并得到了 500 :) 错误声明 -
500 Internal Server Error - http://thepilotslife.com/assets/chat-output.php"在 Firefox 中。 -
对我来说很好用,我刚尝试在 20 秒前打开它很好用这里有一张图片供您参考i62.tinypic.com/k1un8h.png
-
您收到错误 500 的原因与我们收到错误 500 的原因相同。他们的代码中发生了一些奇怪的事情。如果这是您的网站 (pilotslife),请查看您的网络服务器日志。如果是其他人的代码,请告诉他们修复它。
-
链接处的代码不是我的.. 但链接对我来说绝对没问题,我厌倦了使用代理,然后它给出了 500 错误.. 但是没有代理也可以正常工作该网站的其他常规用户也是
标签: php