Erman Belegu
Erman Belegu

Reputation: 4079

Download Gzip XML File in Php

I have an xml file around 30 MB, which is distributed to client as Gzip Xml File through URL, but the problem is that as a Client, I can't save a copy of it into the client's server, as xml file.

When I try with SimpleXMLElement, it says that I have a problem on:

Request must contains the Accept-Encoding: gzip, deflate header

Upvotes: 3

Views: 1174

Answers (1)

Ideal Bakija
Ideal Bakija

Reputation: 639

You can tell PHP directly to uncompress from that URL so that you do not need to change headers in the HTTP stream wrapper context options:

$xml = simplexml_load_file("compress.zlib://http://site.com");

Upvotes: 3

Related Questions