微信公众平台模拟登录成功后,post url和token时,页面出现乱码

李到奥 发布于 2014/07/23 15:16
阅读 1K+
收藏 0
PHP

微信模拟登陆成功后 一键绑定URL和token时页面出现乱码,谢谢各位了。以下是我的代码,请问这样有没有什么问题,

private function dochange(){
$header = array(
'Accept:application/json, text/javascript, */*; q=0.01',
'Accept-Encoding:gzip,deflate,sdch',
'Accept-Language:zh-CN,zh;q=0.8',
'Connection:keep-alive',
'Content-Type:application/x-www-form-urlencoded; charset=UTF-8',
'Host:mp.weixin.qq.com',
'Origin:https://mp.weixin.qq.com',
"Referer:https://mp.weixin.qq.com/advanced/advanced?action=interface&t=advanced/interface&token={$this->token}&lang=zh_CN",
);

$PostDatatwo = array(
"url" => $this->url,
"callback_token" => $this->callback_token,
       );
$useragent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36";
$url = "https://mp.weixin.qq.com/advanced/callbackprofile?t=ajax-response&token={$this->token}&lang=zh_CN";
$ch = curl_init();
curl_setopt($chtwo, CURLOPT_URL, $url);
       curl_setopt($chtwo, CURLOPT_HTTPHEADER,$header);
       curl_setopt($chtwo, CURLOPT_USERAGENT,$useragent);
//设定SSL版本
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
       curl_setopt($ch, CURLOPT_POST, 1);
       curl_setopt($ch, CURLOPT_POSTFIELDS, $PostData);
       curl_setopt($ch, CURLOPT_HEADER, 1);
       curl_setopt($ch, CURLOPT_COOKIE, $this->cookie);
       curl_setopt($ch, CURLOPT_TIMEOUT, 30);
       $result = curl_exec($ch);
curl_close($chtwo);
$data = explode("\n",$result);
var_dump($data);

}
但是打印出来都是乱码的

加载中
0
Legend_x
Legend_x
统一你的字符集UTF8( 页面 程序 数据库 )
返回顶部
顶部