php curl 提交参数中文乱码问题

WBOY
Release: 2016-06-02 11:28:56
Original
1723 people have browsed it

phpcurl乱码

A站通过url形式POST数据注册B站,psot的中文,在B站是显示乱码的;
直接贴码:
$name="黄飞鸿";
$password="123456";
$get_url = "http://www.xxx.com/reg.php?name=".$name."&password=".$password
$row=getToken($get_url);

$obj=json_decode($row);

function getToken($url){
$ch = curl_init();
$this_header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
curl_setopt($ch, CURLOPT_HTTPHEADER,$this_header);
curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
return curl_exec($ch);
}

对方收到的name是乱码的;导致注册失败。
求大侠支招~

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!