curl乱码有两个方面的原因一个是因为我们采集页面的php页面编码与远程文档编码不致导致的,另一种可能是页面进入了gzip压缩传输导致的,那么我们要如何解决这些问题呢?
gzip压缩传输导致乱码
今天在采集京东的时候发现返回的数据是乱码,网上说可能和压缩有关,看了一下京东的头信息的确进行gzip加密,好吧,那就解压吧,代码如下:
$return = gzdecode($return); //将return的字符进行解码
另一种解决办法:
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
页面编码问题,代码如下:
mb_convert_encoding($str, 'utf-8', 'GBK,UTF-8,ASCII');就行了.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)
