‘获取用户基本信息(UnionID机制)
‘在关注者与公众号产生消息交互后,公众号可获得关注者的OpenID(加密后的微信号,每个用户对每个公众号的OpenID是唯一的。对于不同公众号,同一用户的openid不同)。公众号可通过本接口来根据OpenID获取用户基本信息,包括昵称、头像、性别、所在城市、语言和关注时间。)
Public Function Get_UserInfo(openid)
Call C_A("wx_token")
Dim url, params, result
url = "https://api.weixin.qq.com/cgi-bin/user/info?"
params = params & "&access_token=" & Application("wx_token")(0)
params = params & "&openid=" & openid
params = params & "&lang=zh_CN"
url = url & params
Temp = RequestUrl(url,"GET","")
‘Echo Temp
set obj = getjson(Temp)
If CheckData(Temp,"subscribe") Then
If obj.subscribe=1 Then
Get_UserInfo = Array(obj.nickname,obj.sex,obj.headimgurl,obj.country,obj.province,obj.city,obj.subscribe_time,obj.subscribe)
Else
Get_UserInfo = Array("","","","","","","",obj.subscribe)
End If
Session("Reset_Token") = False
ElseIf obj.errcode="40001" And Session("Reset_Token") = False Then
Session("Reset_Token") = True
Call Get_wx_token()
Get_UserInfo = Get_userlist(openid)
Else
Response.Write("Get_UserInfo)=>"&Temp)
Response.End()
End If
set obj = Nothing
End Function
=============================================
互相学习电话微信:18611436777(加微信注明事由)