Joke Collection Website - Public benefit messages - Wechat developer docking ASP code

Wechat developer docking ASP code

Don't listen to people who can't talk nonsense.

The so-called interface is that any language can be called. Not only PHP can be used.

I can only say that some people are not skilled enough or too lazy to do it. My official WeChat account has an ASP interface. Give you a simple reference:

& lt% @ Language =“VBScript“? code page =“6500 1“% & gt;

& lt%

ASP files are saved in UTF 8 format, otherwise garbled codes may appear.

'====================================

These two lines of code are used for initial verification through the WeChat token interface. They will not be used after verification.

Reply. Write? Request ("echostr")

Response. end

'====================================

Dim? "Signature" WeChat encrypted signature

Dim? "timestamp" timestamp

Dim? Random number random number

Dim? Echostr random string

Dim? token

Dim? signature temp

Token =“myweixincode ""You wrote it backstage? token

Signature? =? Request ("signature")

And now? =? Request ("now")

Time stamp? =? Request ("timestamp")

Dim? "ToUserName" developer micro signal

Dim? Sender account (an OpenID)

Dim? Creation time of the "Creation Time" message (integer)

Dim? "MsgType" text

Dim? "WxCont" message content

Dim? "MsgId" message Id, 64-bit integer

Sub? getMSG()

Open? Mistakes? Resume? then

Uh ... clear away

Settings? xDom? =? Server.createobject ("msxml2.domdocument") is rewritten according to your actual server situation.

xDom.load? request

touser name = xdom . getelementsbytagname(“touser name“)。 Project (0). text

from username = xdom . getelementsbytagname(“from username“)。 Project (0). text

msg type = xdom . getelementsbytagname(“msg type“)。 Project (0). text

What if? msg type =“text“? then what wx cont = xdom . getelementsbytagname(“Content“)。 Project (0). text

What if? msg type =“event“? then what wx cont = xdom . getelementsbytagname(“Event“)。 Project (0). text

Settings? xDom=Nothing

End? submarine

Call? getMSG()

What if? From user name = ""? And then what? wxCont=““? then what Response. End? No source or content, processing aborted.

wx cont = replace(wx cont,chr( 13),““)

wx cont = replace(wx cont,chr( 10),““)

wx cont = trim(wx cont)

Function? Yes (key)

Open? Mistakes? Resume? then

Dim? SS, I

keys = replace(keys,“; “,";" )

Ss=split (key, "; “)

For what? i=0? Where to? ultrasonic examination

What if? instr(? lcase(wx cont),lcase(? ss(I)? )? )& gt0? then

has=true

Quit function

End? if

then

has=false

End? function

What if? wxCont =“subscribe“? then what Indicates that there is a new user problem, and the old interface is Hello2BizUser.

Remasg = "Welcome to pay attention" & ampVBCrLf? & amp? "? Home page:? “& ampVBCrLf? & amp? “ www.fj543.com“

Elser. WxCont= "unsubscribe"? S unsubscribe.

Elser. wxCont =“0“? then

Handle custom reply codes.

remasg =“Help:“? & amp? VBCrLf? & "Reply 1 View our website; Reply 2 to check the contact information; "

Elser. wxCont =“ 1“? then

Remasg = "Our website:"&; VBCrLf? & amp? “ www.fj543.com“

other

Remasg = "Thank you for your message. Wu shichang IT technical service team will reply as soon as possible. Please be patient. "

End? if

reMSG=reMSG? & amp? vbcrlf & amp? vbcrlf? & amp? "Reply to the number 0 for help. “? & amp? Error description

out XML =“& lt; xml & gt”? & amp_

“& ltToUserName & gt& lt! 【CDATA【“& amp; From user name & "]]></to user name & gt? & amp_

"& ltfrom username & gt& lt! 【CDATA【“& amp; tousername & amp“】】& gt& lt/FromUserName>? & amp_

"< creation time" & Now ()? & amp“& lt/create time & gt;” ? & amp_

“& ltMsgType & gt& lt! 【CDATA【text】】& gt; & lt/MsgType & gt;” ? & amp_

"< content & gt& lt! 【CDATA【“? & amp? reMSG? & amp? “】】& gt& lt/Content》? & amp_

“& ltFuncFlag>0 & ltFuncFlag》? & amp_

“& lt/xml》

Reply. Write? outXML

% & gt