This is my PHP code to read XML from a URL using SimpleXML and DOM to change some parameters and show it on a web page
The Feed i am reading is at http://tinyurl.com/bo
It's a matter of the Content-Type
HTTP header. The second link uses the application/xml
while the first one uses php's default text/html
. You can change your php script's HTTP headers with the header() function.
header('content-type: application/xml');
I've been able to fetch the original input, the only the header doesn't made it work (at least in firefox), got parse error on line 48580, this is due no encoding was set to the DOMDocument
object, while the original input is in utf-8. With
$doc = new DOMDocument('1.0', 'utf-8');
should work.