微信获取用户详细信息
来源:互联网 发布:广州网站排名优化公司 编辑:程序博客网 时间:2024/06/14 07:10
//详细授权1 public function grant(){ //1户同意授权 获取code $appid='8888888888888888888888888'; $redirect_uri=urlencode("http://wwwwwwwwwwwww/fruits/public/index.php/home/wei/role"); $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"; header('location:'.$url); } ///详细授权2 public function role(){ //2 通过code 换取网页授权access_token $appid="8888888888888888888888"; $secret="788888888888888888888888882"; $code=$_GET['code']; $url="https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$appid."&secret=".$secret."&code=".$code."&grant_type=authorization_code"; //3 获取用户openId $res=$this->httpCurl($url,'get'); $openid=$res['openid']; $access_token=$res['access_token']; //拉去用户的详细信息 $urls="https://api.weixin.qq.com/sns/userinfo?access_token=".$access_token."&openid=".$openid."&lang=zh_CN"; $reslist=$this->httpCurl($urls); var_dump($reslist); }
//获取用户详细信息 public function userDescAction(){ $access_token=$this->accessTokenAction(); $openid='22222222222'; $url="https://api.weixin.qq.com/cgi-bin/user/info?access_token=".$access_token."&openid=".$openid."&lang=zh_CN"; $res=$this->httpCurlAction($url,'get','json',''); var_export($res); var_dump($res);// array (size=13)// 'subscribe' => int 1// 'openid' => string '222222' (length=28)// 'nickname' => string '2222' (length=9)// 'sex' => int 2// 'language' => string 'zh_CN' (length=5)// 'city' => string '22222' (length=9)// 'province' => string '江苏' (length=6)// 'country' => string '中国' (length=6)// 'headimgurl' => string 2/mmo2XhOPTXbs1jxMf80YyEhicpwqdQ1Yia5L9PjuqcwG1ib8YpGtXxM6PUT3UJdwrIlOGpPbKSlRzwWQyD6Kf2/0' (length=128)// 'subscribe_time' => int 1503454568// 'remark' => string '' (length=0)// 'groupid' => int 0// 'tagid_list' =>// array (size=0)// empty }
阅读全文
0 0
- 微信获取用户详细信息
- 微信公众号开发《一》OAuth2.0网页授权认证获取用户的详细信息,实现自动登陆
- (微信公众号开发《一》OAuth2.0网页授权认证获取用户的详细信息,实现自动登陆)http://blog.csdn.net/liaohaojian/article/details/70175835
- 微信 获取用户基本信息
- 微信获取用户基本信息
- 微信获取用户基本信息
- 获取微信用户OpenID
- 获取微信用户OpenID
- sharepoint 获取userprofileManager中用户详细信息
- 社会化登陆-无法获取到用户详细信息
- 微信不弹出授权页面获取用户详细信息
- Python 获取操作系统用户进程详细信息
- 微信小程序授权获取用户详细信息openid
- C#开发微信门户及应用(4)--关注用户列表及详细信息管理
- 获取公众号门店详细信息,php开发管理微信公众号门店
- 微信网页授权获取用户基本信息
- 获取微信用户的openId
- php获取微信用户的openid
- 创建灰度图像直方图(c)
- github上如何删除一个项目(仓库)
- Android Manifest 权限描述大全
- js检测字符的一些总结
- Wifi网络状态操作
- 微信获取用户详细信息
- 均方根值(RMS)+ 均方根误差(RMSE)+标准差(Standard Deviation)
- Comparator 实现集合中元素的比较.输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这321323
- 微信小程序开发(二)-框架
- 指针和数组的区别
- 支付宝支付sdk解析
- jenkins搭建robot的持续集成环境
- Go语言学习之text/template包(The way to go)
- php底层内核回顾总结