Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.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 文件_get_内容不';不要在某些url上工作';_Php_Xml_Rss_File Get Contents - Fatal编程技术网

Php 文件_get_内容不';不要在某些url上工作';

Php 文件_get_内容不';不要在某些url上工作';,php,xml,rss,file-get-contents,Php,Xml,Rss,File Get Contents,我想使用文件内容获取rrs提要 $text = @file_get_contents("http://www.kalbam.lt/?feed=rss2"); 但是我不知道为什么我没有从这个url中得到任何东西(顺便说一句,对于其他rss提要,它是有效的)。 “允许url打开”处于启用状态。 有什么想法吗?一些服务可以简单地检查请求是来自脚本还是来自web浏览器。然后他们可以阻止请求。但是为什么不创建假标题呢 $header=array('GET /1575051 HTTP/1.1', 'Hos

我想使用文件内容获取rrs提要

$text = @file_get_contents("http://www.kalbam.lt/?feed=rss2");
但是我不知道为什么我没有从这个url中得到任何东西(顺便说一句,对于其他rss提要,它是有效的)。 “允许url打开”处于启用状态。
有什么想法吗?

一些服务可以简单地检查请求是来自脚本还是来自web浏览器。然后他们可以阻止请求。但是为什么不创建假标题呢

$header=array('GET /1575051 HTTP/1.1',
'Host: adfoc.us',
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language:en-US,en;q=0.8',
'Cache-Control:max-age=0',
'Connection:keep-alive',
'Host:adfoc.us',
'User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36',
);

然后使用curl检索数据。

可能会删除
@
并检查
错误。日志
?您是否设置了
错误报告
设置?读取。错误报告设置为E\u all无法看到任何错误。警告:文件获取内容():无法打开流:HTTP请求失败!HTTP/1.1 403禁止使用带有用户代理的示例表单@Jaydeep Mor时,我可能必须这样做。奇怪的情况:P。我会试试这个。好的,我知道怎么做了:)