标签:
<?php
//获取access_token
$appid = ‘wx47a6fc3c1187e60d‘; //测试账号appid
$appsecret = ‘525f76d57c7bd72005865e05d03e9dbe‘; //测试账号
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";
$json = file_get_contents($url);
$re = json_decode($json,true);
$access_token = $re[‘access_token‘];
//使用全局ACCESS_TOKEN获取OpenID的详细信息
//$openid = ‘ohzcAsy35rFHUcabQkAXPmv2FC00‘;
// $openid = $_GET[‘openid‘];
// $url = ‘https://api.weixin.qq.com/cgi-bin/user/info?access_token=‘.$access_token.‘&openid=‘.$openid;
// $json = file_get_contents($url);
// $arr = json_decode($json,true);
// $name = $arr[‘nickname‘];
// $imgURL = $arr[‘headimgurl‘];
// $sex = $arr[‘sex‘];
// $province = $arr[‘province‘];
// $city= $arr[‘city‘];
// $country= $arr[‘country‘];
// var_dump($arr);
?>
微信获得access_token
标签:
原文地址:http://www.cnblogs.com/muxiaoye/p/34ca02b0e57374bd0c2fb14adc29353e.html