ASP Micro-trust common Platform Interface Implementation code

Source: Internet
Author: User
Tags cdata chr

 bluedidea See the ASP Micro-communication Platform interface Implementation code, need friends can refer to the following

The code is as follows: <% @Language = "VBScript" codepage= "65001"%> <% ' ********************************************** ' considerations ' 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         &NB Sp       ' Random number ' Dim echostr                 ' Random string Dim Token Dim Signatur Etmp token= "LDWZ" "you write in the background token   signature = Request (" signature ") Nonce = Request (" nonce ") timestamp = Request (" Time Stamp ") ' ********************************************** Dim tousername         ' developer micro-signal Dim Fromusername ' Sender account (an OpenID) Dim createtime         ' Message creation Time (integer) Dim msgtype    -            ' text Dim content                 ' text message content   Set XM L_dOm = Server.CreateObject ("MSXML2.") DOMDocument ") ' Here rewrite Xml_dom.load request Fromusername=xml_dom.getelementsbytagname (" Fromusername ") based on your actual server situation. 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, "")) if (msgtype= "event") then         STREVENTTYPE=XML_ Dom.getelementsbytagname ("event"). Item (0). Text ' micro-letter event         If streventtype= ' subscribe ' Then ' Express Subscribe to micro-trust platform                 STRSEND=GZ (fromusername,tousername)     &NBSP ;   ELSEIF streventtype= "unsubscribe" Then ' Cancel off                 STRSEND=GZ (fromu Sername,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 Second-hand car is a second-hand car online with the entity combined with the second-hand market, Liaocheng used 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 carRelated business. "&_" </Description> "&_" <picurl><! [cdata[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[wxche.jpg]]></picurl> "&_" <url><! [cdata[http://www.0635che.com/ershouche]]></url> "&_" </item> "&_" <item> "&_" < title><! [cdata[Second-hand car transfer procedures]]></title> "&_" <discription><! [cdata[Second-hand car transfer transfer procedures]]></discription> "&_" <picurl><! [cdata[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[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[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.