PHP Curl capture, Server gzip compressed back data what to do

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.