The general server does not randomly return gzip compressed data, typically the header of the client request contains the compression method that your browser can accept,
Accept-encoding:gzip,deflate,sdch
Here is gzip, deflate, SDCH these three kinds of ways, here does not explain what is refers to, do not understand can go to find Gotodo Niang,
Some servers forcibly return gzip compressed data, we collect the time, the return is garbled, simply can not read the use, this time to view the manual
Found in fact Curl has a parameter, curl_setopt ($ch, curlopt_encoding, ' gzip ');
Manual Explanation:
CURLOPT_ENCODING |
The value of "accept-encoding:" in the HTTP request header. The supported encodings are "identity","deflate" and "gzip". If an empty string "", the request header sends all supported encoding types. |
Just add this and it's OK.
PHP Curl capture, Server gzip compressed back data what to do