Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php-HTTP/1.1500文件内容的内部服务器错误_Php - Fatal编程技术网

php-HTTP/1.1500文件内容的内部服务器错误

php-HTTP/1.1500文件内容的内部服务器错误,php,Php,因此,正如标题所说,我得到-HTTP/1.1500文件内容的内部服务器错误 这是错误日志- ! ) 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 UR

因此,正如标题所说,我得到-HTTP/1.1500文件内容的内部服务器错误 这是错误日志-

 ! ) 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
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,它表明字符串每次都是空的。 我也在谷歌上搜索并尝试了其他解决方案,但没有一个奏效

编辑: 对于一些人的链接是给错误,甚至在浏览器上,但工作对我来说很好,所以这里是图片的链接作为参考


还要注意的是,file\u get\u contents和CURL与其他链接完美配合

完全忘了发布此问题的解决方案。 问题是,该页面需要一个以cookie形式存储的php会话id才能工作。 无论如何,这就是我解决问题的方法:

$ch = curl_init();//initialize the curl
curl_setopt($ch, CURLOPT_URL, 'https://thepilotslife.com/chat');//this page sets cookie
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//to overcome SSL verification
curl_exec($ch);//execute the curl to get and set cookies
curl_setopt($ch, CURLOPT_URL, 'https://thepilotslife.com/assets/chat-output.php');//now set the url to page which we needed the output from
echo curl_exec($ch);//echo the result

URLhttp://thepilotslife.com/assets/chat-output.php 在borwser中打开得很好,尝试自己打开,
刚刚尝试并得到一个500:)错误声明
500内部服务器错误-http://thepilotslife.com/assets/chat-output.php“
在Firefox中。对我来说很好。我20秒前刚试过打开它。很好。这里有一张图片供您参考。您出现错误500的原因与我们出现错误500的原因相同。他们的代码里有点怪怪的。如果这是您的站点(pilotslife),那么请查看您的Web服务器日志。如果是别人的代码,那么告诉他们修复它。link上的代码不是我的。。但是这个链接对我来说非常好,我厌倦了使用代理,然后它给出了500个错误。。但在没有代理的情况下对我来说很好,对网站的其他普通用户也很好