startci 发表于 2013-7-29 11:14:27

求助[function.file-get-contents]: failed to open stream: HTTP request failed!

使用file_get_contents抓取网页内容代码如下
$filename = $this->cache_dir.'rss_Parse_'.md5($this->feed_uri);
$rawFeed = file_get_contents($filename);
出现如下问题:
A PHP Error was encounteredSeverity: WarningMessage: file_get_contents(http://feeds.arstechnica.com/arstechnica/index/) : failed to open stream:
=============================================================================
google或者baidu一下,好多这样的问题,解决的方法都是修改php.ini,把allow_url_fopen给启用,改成 allow_url_fopen = On还得设置php.ini里面的user_agent,php默认的user_agent是PHP,我们把它改成Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)来模拟浏览器user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)”============================================================================
按照如上进行配置,重新启动问题依旧,哪位遇到过同类问题怎么解决的,多谢!

startci 发表于 2013-8-1 13:59:16

急切等待:@

startci 发表于 2013-8-4 21:38:16

等待中。。。
页: [1]
查看完整版本: 求助[function.file-get-contents]: failed to open stream: HTTP request failed!