How to solve the php gzip garbled problem

藏色散人
Release: 2023-03-06 12:52:01
Original
2773 people have browsed it

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.

How to solve the php gzip garbled problem

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');
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!