02
2018
11

获取微信公众号access_token源码asp写的源码

<%
Call Wx.C_A("wx_token")'调用函数,如果当前的token有效则不动,否则重新获取并写入缓存

02
2018
11

asp源码微信公众号发送客服消息原码asp写的程序

<%
url="https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="&fff
body="{""touser"":""oOZeU0umT1gk9S3bGl50cc4qC0xU"",""msgtype"":""text"",""text"":{""content"":""新询价消息\n\n询价单位:<a href=\""http://baidu.com\"">张先生(北京)</a>\n询价时间:<a href=\""http://baidu.com\"">"&now()&"</a>\n产品名称:<a href=\""http://baidu.com\"">求购一台锅炉要求安装保修</a>\n需求数量:<a href=\""http://baidu.com\"">1台</a>\n\n<a href=\""http://baidu.com\"">如果不想接收此询盘信息,请点击进入后,注意底部“信息开关”进入关闭接收询盘信息即可。</a>""}}"
'发送纯文字body="{""touser"":""oOZeU0umT1gk9S3bGl50cc4qC0xU"",""msgtype"":""text"",""text"":{""content"":""本次登录的动态密码为:"&pwd&"(2分钟内有效)""}}"
'发送图文消息body="{""touser"":""oOZeU0umT1gk9S3bGl50cc4qC0xU"",""msgtype"":""link"",""link"":{""title"":""中国联通"",""description"":""中国电信"",""url"":""http://wx.tmwcd.com"",""thumb_url"":""http://wx.tmwcd.com/images/card.jpg""}}"

02
2018
11

asp源码获取微信服务器IP地址-微信公众号开发

Set xh = CreateObject("Microsoft.XMLHTTP")
xh.Open "POST",url,0
xh.setRequestHeader "Content-Length", Len(body)
xh.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
xh.Send(body)
Set MyStream=CreateObject("Adodb.Stream")
MyStream.Type = 2
MyStream.Open
MyStream.WriteText xh.responseText
MyStream.Position = 0
postHtml=MyStream.ReadText
MyStream.Close
set xh=nothing

02
2018
11

asp源码微信公众号验证消息真实性

<%
Openid = Wx.Get_Openid
Result = Wx.Get_UserInfo(Openid)
Function sex(v)
if v=1 then
sex = "男"
else
sex = "女"
end if
End Function
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>拉取用户基本信息</title>
<style>
img {
border: none;
border-radius: 100%;
}
</style>
</head>
<body>
<p>
<%
If Result(7) = 1 Then
Wx.Echo "openid:"&Openid
Wx.Echo "昵称:"&Result(0)
Wx.Echo "性别:"&sex(Result(1))
Wx.Echo "头像:<img src='"&Result(2)&"' height='50'>"
Wx.Echo "来自:"&Result(3)&"·"&Result(4)&"·"&Result(5)
Wx.Echo "关注时间:"&DateAdd("s",Result(6),"1970-01-01 08:00:00")
Else
Wx.Echo Openid&"未关注公众号呢"
End If
%>

02
2018
11

asp源码微信公众号获取用户基本信息(PC端)

blic Function Get_Access_Token()
sCode = Request("code")
If sCode ="" And Session("access_token")="" Then
Response.Redirect(GetAuthorization_Code)
Else
If DateDiff("s",Now,Session("access_token_expires"))> 0 Then
Exit Function
End If
End If
Dim url, params,Temp
Url="https://api.weixin.qq.com/sns/oauth2/access_token?"
params = "appid="&s_APPID
params = params & "&secret=" & s_APPSECRET
params = params & "&code=" & sCode
params = params & "&grant_type=authorization_code"
url = Url & params
Temp=RequestUrl(url,"GET","")
'Die Temp
If CheckData(Temp,"access_token") = True Then
set obj = getjson(Temp)
if isobject(obj) Then
Session("access_token") = obj.access_token
Session("access_token_expires") = DateAdd("s",obj.expires_in,Now)
Session("openid") = obj.openid
End If
set obj = Nothing
Else
Response.Write("Get_Access_Token()=>"&Temp) 
Response.End()
End If
End Function

02
2018
11

asp源码微信公众号获取用户基本信息手机端

'获取用户基本信息(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

02
2018
11

asp源码微信公众号获取用户列表

Public Function Get_url()
SCRIPT_NAME = CStr(Request.ServerVariables("SCRIPT_NAME"))
SERVER_NAME = CStr(Request.ServerVariables("HTTP_HOST"))
SERVER_PORT = Request.ServerVariables("SERVER_PORT")
QS=Request.ServerVariables("QUERY_STRING")
http = "http://"
If SERVER_PORT = "443" Then
http = "https://"
End If
if qs<>"" then
Get_url = http & SERVER_NAME & SCRIPT_NAME &"?"&QS
else
Get_url = http & SERVER_NAME & SCRIPT_NAME
end if
End Function

02
2018
11

asp源码微信公众号生成带参数的二维码

Public Function Get_Openid()
If Session("openid")="" Then
s_SCOPE ="snsapi_base"
Call Get_Access_Token()
End If
Get_Openid = Session("openid")
End Function

Public Function C_A(v) '<------Check_Application
Funstr = "Call Get_"&v
If IsArray(Application(v)) Then
If DateDiff("s",Now,Application(v)(1))<0 Then
Execute(Funstr)
End If
Else
Execute(Funstr) 
End If
End Function

02
2018
11

asp源码微信公众号获取jsapi_ticket

Public Function GetAuthorization_Code()
Dim url, params
url = "https://open.weixin.qq.com/connect/oauth2/authorize?"
params = "appid="&s_APPID
params = params & "&redirect_uri=" & server.URLEncode(s_REDIRECT_URI)
params = params & "&response_type=code"
params = params & "&scope="&s_SCOPE
params = params & "&state=123#wechat_redirect"
url = url & params
GetAuthorization_Code = (url)
End Function

02
2018
11

asp源码微信公众号网页授权获取用户基本信息

Public Function Get_Access_Token()
sCode = Request("code")
If sCode ="" And Session("access_token")="" Then
Response.Redirect(GetAuthorization_Code)
Else
If DateDiff("s",Now,Session("access_token_expires"))> 0 Then
Exit Function
End If
End If
Dim url, params,Temp
Url="https://api.weixin.qq.com/sns/oauth2/access_token?"
params = "appid="&s_APPID
params = params & "&secret=" & s_APPSECRET
params = params & "&code=" & sCode
params = params & "&grant_type=authorization_code"
url = Url & params
Temp=RequestUrl(url,"GET","")
'Die Temp
If CheckData(Temp,"access_token") = True Then
set obj = getjson(Temp)
if isobject(obj) Then
Session("access_token") = obj.access_token
Session("access_token_expires") = DateAdd("s",obj.expires_in,Now)
Session("openid") = obj.openid
End If
set obj = Nothing
Else
Response.Write("Get_Access_Token()=>"&Temp) 
Response.End()
End If
End Function