I've been using SimplePie for about 4 yrs now w/Curl...and it's worked great up until 2-6-17.
For the last 12+ hrs I've been trying to narrow down why it won't parse any of craigslists list feeds. I've tried ever possible scenario available. I do get a 200 return with the data, but it includes it with an error.
is invalid XML, likely due to invalid characters. XML error: Not well-formed (invalid token) at line 1, column 1
Here's the weird thing, it works with fopensocket with no problems.
Here here some of my settings:
Ubuntu 14.04
Apache/Ngnix
PHP 5.6
Host: 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(true);
$rss->force_fsockopen(false);
$rss->set_input_encoding('UTF-8');
$rss->set_output_encoding('UTF-8');
$rss->init();
$rss->handle_content_type();
Here's the return of the header:
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 Vary: 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
I've done a RSS validate and it didn't have any significant errors.
Also, tried it on a brand new server/same settings and got the same result.
They do work on the demo site simplepie.org/demo...so I'm thinking it has something to do with my server settings.
Any help would be appreciated!
Found it! Now works with older proxies What to do with extra HTTP header from proxy?
I added this on line 158 of FILE.php
// 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);}