Home > Backend Development > PHP Tutorial > php发送http请求回到的中文是乱码

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:46:27
Original
868 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:
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
Latest Issues
curl simulated login
From 1970-01-01 08:00:00
0
0
0
Convert cURL command line to PHP cURL code
From 1970-01-01 08:00:00
0
0
0
Convert command line cURL to PHP cURL
From 1970-01-01 08:00:00
0
0
0
How to set boolean value true in php curl
From 1970-01-01 08:00:00
0
0
0
Please tell me, php curl request page shows blank
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template