php crawling page garbled code
When crawling the page, there is a garbled code similar to The solution is as follows:
1. Conversion code
1 |
|
2. When the data is compressed by gzip and
curl to obtain the data, set and add the following options:
1 |
|
To use the file_get_contents function, you need to install the zlib library
1 |
|
3. Garbled characters
are displayed after the data is obtained. Add the following code at the top
1 |
|