Open remote gzip XML file for use with SimpleXML

2019-04-15 12:46发布

问题:

I'm having trouble retrieving and decompressing a remote gzip XML file.

To get the file I'm using:

$url = 'http://www.domain.com/xml.gzip';
$linkToXmlFile = fopen("compress.zlib://$url", "r");

Then I've tried:

try {
    $xml = new SimpleXmlElement($rawFeed);
    ...
}

To no avail.

回答1:

Tried this ?

$xml = new SimpleXMLElement("compress.zlib://$url", NULL, TRUE);


标签: php xml gzip