//微信远程登录绑定账号
public function Curl_login($username,$pwd){
$config_token = "XiaoDengPHP";
$pwd = md5($pwd);
$url = "https://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN";
$postArray = array("username=".$username,"pwd=".$pwd,"imgcode=","f=json");
$fields = implode("&", $postArray);
$filedir = $_SERVER['DOCUMENT_ROOT']."/Cookies";
$cookie_file = $filedir."/cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); //表示是https协议提交
curl_setopt($ch, CURLOPT_HEADER, 0); //不返回header部分
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); //生产Cookies并保存在指定目录下
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //将curl_exec()获取的信息以文件流的形式返回,而不是直接输出。
curl_setopt($ch, CURLOPT_REFERER,"https://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN"); //跳转指向
$result = curl_exec($ch);
return json_decode($result);
// 关闭CURL会话
curl_close($ch);
}
public function auth($token)
{
$data = array(
$_GET['timestamp'],
$_GET['nonce'],
$token);
$sign = $_GET['signature'];
sort($data);
$signature = sha1(implode($data));
if($signature === $sign){
echo ($_GET['echostr']);
exit;
}else{
return false;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有