Prashant Singh
Prashant Singh

Reputation: 3793

retrieving content from deflated , gzipped file

I am trying to fetch contents from a website using CURL in PHP. However, the issue is , the site is returning most probably a deflated or gzipped contents. See contents here and actual website here.

Is there any way to get the contents back. I need to retrieve the values available on the website. Any link or suggestion for this will be appreciated.

Thanks !

Upvotes: 0

Views: 74

Answers (2)

raidenace
raidenace

Reputation: 12836

In your curl settings specify:

Accept-Encoding: gzip, deflate

as one of the headers.

Not tested, but I believe it is set as:

curl_setopt($ch,CURLOPT_ENCODING , "gzip");

Upvotes: 3

Emo Mosley
Emo Mosley

Reputation: 535

You could load the gzipped file that you receive into a variable, then use gzuncompress().

Upvotes: 1

Related Questions