<?php
|
header("Content-type: text/html; charset=utf-8");
|
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
|
$code = $_GET["code"];
|
$APPID = $_GET["APPID"];
|
$wx_url = "https://api.966120.com.cn/v3/weixin/?method=weixin_Appid&APPID=".$APPID."&UnixTime=".time()."&Sign=vic";
|
$wxinfo=file_get_contents($wx_url);
|
|
$wxinfo=json_decode($wxinfo,true);
|
|
function request_post($url = '', $param = '')
|
{
|
if (empty($url) || empty($param)) {
|
return false;
|
}
|
|
$postUrl = $url;
|
$curlPost = $param;
|
// ³õʼ»¯curl
|
$curl = curl_init();
|
curl_setopt($curl, CURLOPT_URL, $postUrl);
|
curl_setopt($curl, CURLOPT_HEADER, 0);
|
// ÒªÇó½á¹ûΪ×Ö·û´®ÇÒÊä³öµ½ÆÁÄ»ÉÏ
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
// postÌá½»·½Ê½
|
curl_setopt($curl, CURLOPT_POST, 1);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
|
// ÔËÐÐcurl
|
$data = curl_exec($curl);
|
curl_close($curl);
|
|
return $data;
|
}
|
|
$appid = $wxinfo["wx_APPID"];
|
$APPSECRET = $wxinfo["wx_APPSECRET"];
|
$access_token = $wxinfo["access_token"];
|
$url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=$access_token";
|
$bodys = "{\"code\": \"$code\"} ";
|
//echo $url;
|
$info = request_post($url, $bodys);
|
// $info=json_decode($info,true);
|
|
/* $session_key = $info["session_key"];
|
$expires_in = $info["expires_in"];
|
$openid = $info["openid"]; */
|
|
echo $info;
|
|
|
|
?>
|