Hi,
I have a problem parsing an rss feed using simplexml_load_file - this is strange as i have used the same code to parse literally 1000s of different feeds in the past, and even stranger in that if i put the feed source on our server as a .xml file then my code parses it successfully.
The relevant code snippet:
$xml = simplexml_load_file("http://www.quidco.com/blog/?feed=rss2", ... XMLElement', LIBXML_NOCDATA);
The errors i get are:
Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.quidco.com/blog/?feed=rss2:1: parser error : Start tag expected, '<' not found in [my php script]
Warning: simplexml_load_file() [function.simplexml-load-file]: 2977 in [my php script]
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in [my php script]
Any ideas or suggestions will be much appreciated thanks.
d.
simplexml_load_file and rss problem
Moderator: General Moderators
Re: simplexml_load_file and rss problem
The site is sending the RSS in a chunked encoding. All you need to know is that screws up the XML.
Use something like cURL to download the feed, then run SimpleXML off the local copy.
Use something like cURL to download the feed, then run SimpleXML off the local copy.
Re: simplexml_load_file and rss problem
Thanks. I guess the chunked encoding explains the extra characters i can see when i use file_get_contents to copy the feed locally - i'll try curl.