Home>Article>Backend Development> How to solve the php gzip garbled problem
php gzip is garbled because the returned content is compressed by gzip. The solution is to add "curl_setopt($curl, CURLOPT_ENCODING, 'gzip');" to the curl request.
Recommendation: "PHP Video Tutorial"
PHP Curl Content-Encoding: Solving gzip garbled problem
In the process of using php curl to connect hugegraph, I found that sending results to gremlin returned garbled characters. The screenshot is as follows:
Compare this request with ordinary requests:
It is found that the garbled request that returns garbled characters contains Content-Encoding: gzip, that is, the returned content is compressed by gzip, so you need to add
curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
to the curl request to return to normal.
The above is the detailed content of How to solve the php gzip garbled problem. For more information, please follow other related articles on the PHP Chinese website!