Wednesday, 7 August 2013

XML File Gzip and PHP

XML File Gzip and PHP

I'm try to read an external XML file with a PHP script, no wmatter what I
try I get an "empty document" error. If I open the url in my browser I can
access and read the xml fine.
There are numerous other posts on stack overflow with similar problem as
mine but none of the solutions work in my case.
This is my code:
$url="http://xml.example.com";
$xml = new SimpleXMLElement("compress.zlib://$url", NULL, TRUE);
parser error : Document is empty in /home/admin/public_html/xml/index2.php
on line 4
Apparently the 3rd party service requires that I explicitly request gzip
compression.
Any ideas?
Thanks,
Alan.

No comments:

Post a Comment