龙空技术网

非主流ASP(vbs脚本)实现json接口,可分离前后端。

Patrick霍钦 187

前言:

现时同学们对“asp 字符串函数”都比较注重,小伙伴们都想要分析一些“asp 字符串函数”的相关内容。那么小编也在网络上收集了一些有关“asp 字符串函数””的相关文章,希望大家能喜欢,咱们一起来学习一下吧!

接收端:

dim strAAA,strBBB,strCCC,a,b

strAAA=Request.ServerVariables("HTTP_Token")

strCCC=Request.ServerVariables("HTTP_Content_Type")

a=request.TotalBytes

if a>0 then

b=Request.BinaryRead(a)

strBBB=BytesToBstr(b,"UTF-8")

end if

response.write "Content-Type:"&strCCC&","

response.write "Token:"&strAAA&","

response.write "Body:"&strBBB

response.end

注:BytesToBstr这个函数就不写了。

发送端:

'##调用企业微信接口发送微信短消息##

'获取Token

set objHttp=server.createobject("Microsoft.XMLHTTP")

objHttp.open "GET", ";corpsecret=BBBBBBBBBBBBBBBB", False

objHttp.setRequestHeader "Content-Type","application/json; charset=UTF-8"

objHttp.Send

strReturn=objHttp.responseText

set objHttp=nothing

dim strToken

strSurl=split(strReturn,",")

strReturn=strSurl(2)

strSurl=split(strReturn,"""")

strToken=strSurl(3)

response.write strToken

response.write "<br><br><br><br>"

'构造微信短消息的json字符串

strBody="{""touser"" : ""qy01c736ef138ac00329677755d0"",""toparty"" : """",""totag"" : """",""msgtype"" : ""text"",""agentid"" : 1000002,""text"" : {""content"" : ""参考号:3232-3223\n提单号:A569A77305\n\n进港:海放:码放:配载:\n\n参考号:3232-334443\n提单号:177DSJSJS00270\n\n进港:海放:码放:配载:\n\n""},""safe"":0,""enable_id_trans"": 0,""enable_duplicate_check"": 0,}"

'调用企业微信接口发送

set objHttp=server.createobject("Microsoft.XMLHTTP")

objHttp.open "POST", ""&strToken, False

objHttp.setRequestHeader "Content-Type","application/json; charset=UTF-8"

objHttp.Send strBody

strReturn=objHttp.responseText

set objHttp=nothing

response.write strReturn

标签: #asp 字符串函数