Ejemplo n.º 1
0
 /**
  * 获取token
  * 2013年9月28日10时更新,改用LeaWeiXinClient获取数据替换file_get_contents
  */
 function get_access_token()
 {
     $config = get_config();
     $token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$config['AppId']}&secret={$config['AppSecret']}";
     //$token_json = file_get_contents($token_url);
     vendor('Wx.LeaWeiXinClient');
     $lea = new LeaWeiXinClient();
     $token_json = $lea->get($token_url, null);
     $token_json = $token_json['body'];
     $token_arr = json_decode($token_json, true);
     return $token_arr['access_token'];
 }
Ejemplo n.º 2
0
function get_user_group()
{
    $access_token = get_access_token();
    $url = "https://api.weixin.qq.com/cgi-bin/groups/get?access_token=" . $access_token;
    vendor("wx.LeadWeiXinClient");
    $lea = new LeaWeiXinClient();
    $re = $lea->get($url, null);
    dump($re);
}