首页 文章

SimplePie没有解析RSS Feed

提问于
浏览
0

我已经使用SimplePie大约4年了,现在已经和Curl一起使用......它的工作时间很长,直到2-6-17 .

在过去的12小时里,我一直试图缩小为什么它不解析任何craigslists列表提要 . 我尝试过可能的场景 . 我确实获得了带有数据的200返回,但它包含错误 .

是无效的XML,可能是由于无效的字符 . XML错误:第1行第1列的格式不正确(令牌无效)

这是奇怪的事情,它与fopensocket一起工作没有问题 .

这里有一些我的设置:

Ubuntu 14.04 Apache / Ngnix PHP 5.6主机:VPS DigitalOcean SimplePie v-1.4.3 $ rss = new SimplePie(); $ rss-> set_feed_url( 'http://detroit.craigslist.org/search/apa?availabilityMode=0&bedrooms=3&format=rss&min_price=800'); $ rss-> useragent ='Mozilla / 5.0(Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7)Gecko / 20070914 Firefox / 2.1.0.7'; $ rss-> get_item_quantity(10); $ rss-> force_feed(真); $ rss-> force_fsockopen(假); $ rss-> set_input_encoding( 'UTF-8'); $ rss-> set_output_encoding( 'UTF-8'); $ rss->的init(); $ rss-> handle_content_type();

这是 Headers 的返回:

HTTP / 1.1 200 OK Cache-Control:max-age = 900,public Last-Modified:Mon,13 Feb 2017 18:24:12 GMT Date:Mon,13 Feb 2017 18:24:12 GMT Content-Encoding:gzip变化:Accept-Encoding Content-Length:5991 Content-Type:application / rss xml; charset = utf-8 X-Frame-Options:SAMEORIGIN Server:Apache Expires:Mon,13 Feb 2017 18:39:12 GMT

我做了一个RSS验证,它没有任何重大错误 .

此外,尝试在一个全新的服务器/相同的设置,并得到相同的结果 .

他们在演示站点上工作simplepie.org/demo...so我认为它与我的服务器设置有关 .

任何帮助,将不胜感激!

1 回答

  • 0

    找到了!现在可以使用旧代理What to do with extra HTTP header from proxy?

    我在FILE.php的第158行添加了这个

    // cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string
                $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
                $this->headers = array_pop($this->headers);//$this->headers[0];//
                if (false !== stripos($this->headers, "HTTP/1.0 200 Connection established\r\n\r\n")) { $this->headers = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $this->headers);}
    

相关问题