ASP Micro-trust common Platform Interface Implementation code _ Application Skills

Source: Internet
Author: User
Tags cdata chr

Copy Code code as follows:

<% @Language = "VBScript" codepage= "65001"%>
<%
'**********************************************
' Attention matters
' ASP files need to be saved in UTF-8 format, otherwise garbled.
' The following two lines of code are to be validated through a micro-communication interface.
' Response.Write Request ("Echostr")
' Response.End
'**********************************************
Dim signature ' Micro-letter encryption Signature
Dim timestamp ' Timestamp
Dim nonce ' Random Number
' Dim echostr ' random String
Dim Token
Dim signaturetmp
token= "LDWZ" ' you write in the background token

Signature = Request ("signature")
Nonce = Request ("nonce")
timestamp = Request ("timestamp")
'**********************************************
Dim tousername ' Developer Micro-signal
Dim Fromusername ' Sender Account (an OpenID)
Dim createtime ' Message Creation time (integer)
Dim Msgtype ' Text
Dim content ' Text Message contents

Set xml_dom = Server.CreateObject ("MSXML2. DOMDocument ")" Here to overwrite your actual server situation
Xml_dom.load Request
Fromusername=xml_dom.getelementsbytagname ("Fromusername"). Item (0). Text ' Sender micro-letter Account
Tousername=xml_dom.getelementsbytagname ("Tousername"). Item (0). Text ' receiver micro-letter account number. That's our public platform account.
Msgtype=xml_dom.getelementsbytagname ("Msgtype"). Item (0). Text
If msgtype= "text" Then
Content=xml_dom.getelementsbytagname ("Content"). Item (0). Text
End If
' Dim mingling
' Mingling=replace (CONTENT,CHR (13), "")
' Mingling=trim (replace (MINGLING,CHR (10), ""))
if (msgtype= "event") then
Streventtype=xml_dom.getelementsbytagname ("event"). Item (0). Text ' micro-letter Event
If streventtype= "subscribe" then "subscribe to micro-trust public platform
Strsend=gz (Fromusername,tousername)
ElseIf streventtype= "unsubscribe" Then ' Cancel off
Strsend=gz (Fromusername,tousername)
End If
Else
' Strsend=text (fromusername,tousername,content)
Strsend= ""
End If
Response.Write Strsend
Set xml_dom=nothing
' ************* The following code is only for debugging purposes ***********
' Filepath=server.mappath (".") & "\wx.txt"
' Set fso = Server.CreateObject (' Scripting.FileSystemObject ')
' Set FOPEN=FSO. OpenTextFile (filepath, 8, true)
' Fopen.writeline (strsend)
' Set fso=nothing
' Set fopen=nothing
' **************** Debug End ************************

function Gz (fromusername,tousername)
gz= "<xml>" &_
"<tousername><! [cdata["&fromusername&"]]></tousername> "&_
"<fromusername><! [cdata["&tousername&"]]></fromusername> "&_
"<CreateTime>" &now& "</CreateTime>" &_
"<MsgType>news</MsgType>" &_
"<ArticleCount>5</ArticleCount>" &_
"<Articles>" &_
"<item>" &_
"<Title> no difference in second-hand car trading market </Title>" &_
"<Description> Liaocheng used car is a second-hand car online and entities combined with the second-hand market, to Liaocheng second-hand car information mainly to provide Liaocheng and the surrounding city of second-hand car trading information, you can free to view and publish second-hand car information, for second-hand car related business." "&_
"</Description>" &_
"<picurl><! [cdata[yun_qi_img/wxlogo.jpg]]></picurl> "&_
"<url><! [cdata[http://www.0635che.com/]]></url> "&_
"</item>" &_
"<item>" &_
"<title><! [cdata[View second-hand car information]]></title> "&_
"<discription><! [cdata[all second-hand car information]]></discription> "&_
"<picurl><! [cdata[yun_qi_img/wxche.jpg]]></picurl> "&_
"<url><! [cdata[http://www.0635che.com/ershouche]]></url> "&_
"</item>" &_
"<item>" &_
"<title><! [cdata[second-hand car transfer formalities]]></title> "&_
"<discription><! [cdata[Second-hand car transfer transfer procedures]]></discription> "&_
"<picurl><! [cdata[yun_qi_img/wxgh.jpg]]></picurl> "&_
"<url><! [cdata[http://www.0635che.com/guohu]]></url> "&_
"</item>" &_
"<item>" &_
"<title><! [cdata[What is not earning the difference]]></title> "&_
"<discription><! [cdata[E-commerce]]></discription> "&_
"<picurl><! [cdata[yun_qi_img/wxxw.jpg]]></picurl> "&_
"<url><! [cdata[http://www.0635che.com/service]]></url> "&_
"</item>" &_
"<item>" &_
"<title><! [cdata[Contact Us]]></title> "&_
"<discription><! [cdata[Contact Us]]></discription> "&_
"<picurl><! [cdata[yun_qi_img/wxlx.jpg]]></picurl> "&_
"<url><! [cdata[http://www.0635che.com/]]></url> "&_
"</item>" &_
"</Articles>" &_
"<FuncFlag>1</FuncFlag>" &_
"</xml>"
End Function

function text (FROMUSERNAME,TOUSERNAME,RETURNSTR)
text= "<xml>" &_
"<tousername><! [cdata["&fromusername&"]]></tousername> "&_
"<fromusername><! [cdata["&tousername&"]]></fromusername> "&_
"<CreateTime>" &now& "</CreateTime>" &_
"<msgtype><! [cdata[text]]></msgtype> "&_
"<content><! [Cdata[& Returnstr & "]]></content>" &_
"<FuncFlag>0<FuncFlag>" &_
"</xml>"
End Function
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.