Hot answers tagged gzip
3
Here is the relevant section of code from stack.PHP.
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_ENCODING,'gzip'); // Needed by API
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
1
gzuncompress is for ZLIB not GZIP. The two algorithms are related, but not identical. gzuncompress isn't strictly guaranteed to decompress all ZLIB streams actually, its just guaranteed to decode the results of gzcompress. Which is honestly really weird.
The appropriate function is gzdecode.
If that's not available, http_inflate should also work.
Only top voted, non community-wiki answers of a minimum length are eligible