How to decode "Content-Encoding: gzip, gzip" using curl? How to decode "Content-Encoding: gzip, gzip" using curl? nginx nginx

How to decode "Content-Encoding: gzip, gzip" using curl?


You can decode it by trimming off the headers and using gzinflate.

$url = "http://www.dealstan.com"$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url); // Define target sitecurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return page in stringcurl_setopt($cr, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2');curl_setopt($ch, CURLOPT_ENCODING, "gzip");     curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects$return = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $return = gzinflate(substr($return, 10));print_r($return);