curl_setopt($curl, CURLOPT_HEADER, true);
The result curl_execwill also include HTTP response headers, which you can parse to see if it has been gzipped.
Gzipped's answer would be:
HTTP/1.1 200 OK
Server: Apache
Content-Type: text/html
Content-Encoding: gzip
Content-Length: 26395
[GZIP COMPRESSED DATA]
So, you can first break the response into headers and content, and then analyze the headers to see if it is talking about gzip-encoded content.
source
share