php模拟访问返回乱码有关问题

WBOY
Release: 2016-06-13 12:09:51
Original
1002 people have browsed it

php模拟访问返回乱码问题

php通过curl模拟访问,经常会出现返回为乱码。目前我遇到的乱码问题主要有两种:

?

1、编码问题

? ? 解决方案,利用php的mb_detect_encoding($str) 方法,去查看返回字符串的编码,然后通过iconv转换成想

要编码
2、Accept-Encoding为gzip等压缩问题

? ?解决方案,这种乱码主要指,服务器根据Accept-Encoding的类型,返回相应的压缩,但是浏览器上看到的是正确的,模拟时是错误的,为什么的,因为浏览器会帮我们自动解压,程序必须解压相应返回字符串才能得到正确结果?

? ?详细请看:http://honda418.iteye.com/blog/406844

?

?

?

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template