php发送http请求回到的中文是乱码

WBOY
Release: 2016-06-13 12:46:27
Original
829 people have browsed it

php发送http请求返回的中文是乱码

本帖最后由 wang23412 于 2013-05-24 15:46:14 编辑 小弟刚开始学习php, 用curl发送一个http请求,但是返回的中文全是乱码。

在浏览器直接浏览url是这样的。


但是用php抓取的话就成这样了。


代码如下,求各位指点下怎么解决。
<br />
$url='http://www.battlenet.com.cn/api/wow/achievement/2144';<br />
$ch=curl_init();<br />
$head=array(<br />
"Content-Type: application/json;charset=UTF-8"<br />
);<br />
curl_setopt($ch,CURLOPT_HTTPHEADER,$head);<br />
curl_setopt($ch,CURLOPT_URL,$url);<br />
curl_exec($ch);<br />
curl_close($ch);<br />
Copy after login
PHP Curl 乱码 URL
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