Forum Moderators: coopster

Message Too Old, No Replies

SimpleXML and .xml.gz files

         

martymac

1:05 am on Oct 15, 2009 (gmt 0)

10+ Year Member



Now I swear this code was working last week, but in any case here goes...

I want to open archive.xml.gz using SimpleXML. Here is my code:

$xmlgz = gzopen($xml_loc, 'r');
$contents = gzread($xmlgz, 10000);
$xml = simplexml_load_string($contents);

However this is not working. When I do var_dump($xml) I get

bool(false)

But I know the .gz file is being opened because when I do print_r($contents) the entire XML file is returned as a string on the page. Any thoughts?

martymac

4:06 am on Oct 16, 2009 (gmt 0)

10+ Year Member



Anyone?

eeek

11:57 pm on Oct 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sounds like the XML is flawed. Have you checked for errors?

[php.net...]