Home >Backend Development >PHP Problem >How to solve php curl garbled problem

How to solve php curl garbled problem

藏色散人
藏色散人Original
2020-11-10 09:36:482625browse

php curl garbled solution: first open the corresponding code file; then specify the request header, code such as "curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");".

How to solve php curl garbled problem

Recommended: "PHP Video Tutorial"

PHP CURL collection garbled code solution

Problem description

Use a browser to open the web page, and it displays normally. Using PHP CURL to collect, all returned are some garbled blocks. Beginning with isG

How to solve php curl garbled problem

Solution

Specify the request header Accept-Encoding: gzip, deflate

Code

curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");

Problem Solving

The above is the detailed content of How to solve php curl garbled problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:How to hide php in nginxNext article:How to hide php in nginx