当前位置:网站首页>ASP voice notification interface docking demo
ASP voice notification interface docking demo
2022-07-27 04:18:00 【Mutual wireless SMS interface】
<%@LANGUAGE=“VBSCRIPT” CODEPAGE=“936”%>
<%
' Interface type : Mutual wireless voice notification interface .
' Account registration : Please open an account through this address http://user.ihuyi.com/?DKimmu
' matters needing attention :
'(1) During commissioning , Please read the interface documentation carefully ;
'(2) Please use APIID( see APIID Please log in to the user center -> Voice notification -> Product overview ->APIID) And APIkey To call the interface ;
'(3) This code is only for reference when accessing the wireless voice notification interface , Customers can write their own according to their actual needs ;
Response.Charset = "gb2312"
'
'asp UTF turn GB2312 take UTF8 Convert encoded text to GB Coded text asp Code
function UTF2GB(UTFStr)
for Dig=1 to len(UTFStr)
' If UTF8 Encoded text in % At the beginning, it is converted
if mid(UTFStr,Dig,1)="%" then
'UTF8 Coded text greater than 8 Then it is converted to Chinese characters
if len(UTFStr) >= Dig+8 then
GBStr=GBStr & ConvChinese(mid(UTFStr,Dig,9))
Dig=Dig+8
else
GBStr=GBStr & mid(UTFStr,Dig,1)
end if
else
GBStr=GBStr & mid(UTFStr,Dig,1)
end if
next
UTF2GB=GBStr
end function
'GB2312 turn UTF8 Of asp Code take GB Convert encoded text to UTF8 Code text
Function toUTF8(szInput)
Dim wch, uch, szRet
Dim x
Dim nAsc, nAsc2, nAsc3
' If the input parameter is empty , Then exit the function
If szInput = "" Then
toUTF8 = szInput
Exit Function
End If
' Start conversion
For x = 1 To Len(szInput)
' utilize mid Function partition GB Code text
wch = Mid(szInput, x, 1)
' utilize ascW Function returns each GB Coded text Unicode Character code
' notes :asc Function returns ANSI Character code , Pay attention to differences
nAsc = AscW(wch)
If nAsc < 0 Then nAsc = nAsc + 65536
If (nAsc And &HFF80) = 0 Then
szRet = szRet & wch
Else
If (nAsc And &HF000) = 0 Then
uch = "%" & Hex(((nAsc \ 2 ^ 6)) Or &HC0) & Hex(nAsc And &H3F Or &H80)
szRet = szRet & uch
Else
'GB Coded text Unicode The character code is in 0800 - FFFF Between the use of three byte template
uch = "%" & Hex((nAsc \ 2 ^ 12) Or &HE0) & "%" & _
Hex((nAsc \ 2 ^ 6) And &H3F Or &H80) & "%" & _
Hex(nAsc And &H3F Or &H80)
szRet = szRet & uch
End If
End If
Next
toUTF8 = szRet
End Function
' Binary to hexadecimal asp Code
function c2to16(x)
i=1
for i=1 to len(x) step 4
c2to16=c2to16 & hex(c2to10(mid(x,i,4)))
next
end function
' Binary to decimal asp Code
function c2to10(x)
c2to10=0
if x="0" then exit function
i=0
for i= 0 to len(x) -1
if mid(x,len(x)-i,1)="1" then c2to10=c2to10+2^(i)
next
end function
' Hexadecimal to binary asp Code
function c16to2(x)
i=0
for i=1 to len(trim(x))
tempstr= c10to2(cint(int("&h" & mid(x,i,1))))
do while len(tempstr)<4
tempstr="0" & tempstr
loop
c16to2=c16to2 & tempstr
next
end function
function c10to2(x)
mysign=sgn(x)
x=abs(x)
DigS=1
do
if x<2^DigS then
exit do
else
DigS=DigS+1
end if
loop
tempnum=x
i=0
for i=DigS to 1 step-1
if tempnum>=2^(i-1) then
tempnum=tempnum-2^(i-1)
c10to2=c10to2 & "1"
else
c10to2=c10to2 & "0"
end if
next
if mysign=-1 then c10to2="-" & c10to2
end function
'UTF8 The encoded text will be converted to Chinese characters
function ConvChinese(x)
A=split(mid(x,2),"%")
i=0
j=0
for i=0 to ubound(A)
A(i)=c16to2(A(i))
next
for i=0 to ubound(A)-1
DigS=instr(A(i),"0")
Unicode=""
for j=1 to DigS-1
if j=1 then
A(i)=right(A(i),len(A(i))-DigS)
Unicode=Unicode & A(i)
else
i=i+1
A(i)=right(A(i),len(A(i))-2)
Unicode=Unicode & A(i)
end if
next
if len(c2to16(Unicode))=4 then
ConvChinese=ConvChinese & chrw(int("&H" & c2to16(Unicode)))
else
ConvChinese=ConvChinese & chr(int("&H" & c2to16(Unicode)))
end if
next
end function
'GB2312 Chinese to unicode(&#) Of asp Code take GB Convert encoded text to unicode Code text
function chinese2unicode(Str)
dim i
dim Str_one
dim Str_unicode
if(isnull(Str)) then
exit function
end if
for i=1 to len(Str)
Str_one=Mid(Str,i,1)
Str_unicode=Str_unicode&chr(38)
Str_unicode=Str_unicode&chr(35)
Str_unicode=Str_unicode&chr(120)
Str_unicode=Str_unicode& Hex(ascw(Str_one))
Str_unicode=Str_unicode&chr(59)
next
chinese2unicode=Str_unicode
end function
'URL Address encoding and decoding function
Function URLDecode(enStr)
dim deStr
dim c,i,v
deStr=""
for i=1 to len(enStr)
c=Mid(enStr,i,1)
if c="%" then
v=eval("&h"+Mid(enStr,i+1,2))
if v<128 then
deStr=deStr&chr(v)
i=i+2
else
if isvalidhex(mid(enstr,i,3)) then
if isvalidhex(mid(enstr,i+3,3)) then
v=eval("&h"+Mid(enStr,i+1,2)+Mid(enStr,i+4,2))
deStr=deStr&chr(v)
i=i+5
else
v=eval("&h"+Mid(enStr,i+1,2)+cstr(hex(asc(Mid(enStr,i+3,1)))))
deStr=deStr&chr(v)
i=i+3
end if
else
destr=destr&c
end if
end if
else
if c="+" then
deStr=deStr&" "
else
deStr=deStr&c
end if
end if
next
URLDecode=deStr
end function
' Determine whether it is a valid hexadecimal code
function isvalidhex(str)
dim c
isvalidhex=true
str=ucase(str)
if len(str)<>3 then isvalidhex=false:exit function
if left(str,1)<>"%" then isvalidhex=false:exit function
c=mid(str,2,1)
if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isvalidhex=false:exit function
c=mid(str,3,1)
if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isvalidhex=false:exit function
end function
Function Post(url,data)
dim Https
set Https=server.createobject("MSXML2.XMLHTTP")
Https.open "POST",url,false
Https.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
Https.send data
if Https.readystate=4 then
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write Https.responseBody
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "utf-8"
Post = objstream.ReadText
objstream.Close
set objstream = nothing
set https=nothing
end if
End Function
dim target,post_data,content,mobile
mobile = "138xxxxxxxx" ' Phone number
target = "http://api.vm.ihuyi.com/webservice/voice.php?method=Submit"
content = " Your order number is :0648. Has been sent by downwind express , Please remember to check ."
post_data = "account= user name &password= password &mobile="&mobile&"&content="&content
' The user name is the login user center -> Voice notification -> Product overview ->APIID
' To view the password, please log in to the user center -> Voice notification -> Product overview ->APIKEY
tempstr = UTF2GB(Post(target,post_data))
'response.Write(tempstr)
'if instr(tempstr," Submit successfully ")>0 Then
'response.Write("true")
'else
'response.Write("error")
'end if
Dim len1,len2
len1 = instr(1,tempstr,"",1)-1
len2 = instr(1,tempstr,"",1)
'response.Write(len2)
code=left(tempstr,len1)
code=right(code,(len1-len2-5))
response.Write(code)
Dim len3,len4
len3 = instr(1,tempstr,"",1)-1
len4 = instr(1,tempstr,"",1)
'response.Write(len2)
msg=left(tempstr,len3)
msg=right(msg,(len3-len4-4))
response.Write(msg)
%>
边栏推荐
- Development of NFT digital collection system: Xiaoyi digital intelligence helps brands launch NFT with one click on the chain
- c# 获取uuid
- 2022 retraining question bank and answers for main principals of hazardous chemical business units
- Towhee weekly model
- Leetcode:433. minimal genetic change
- spicy之evt接口定义文件
- Framework learning journey: init process startup process
- 暑假加餐|有钱人和你想的不一样(第5天)+电力系统潮流仿真(文档和Matlab代码)
- leetcode每日一练:将句子排序
- What is the principle difference between lateinit and lazy in kotlin
猜你喜欢

三种常见的移动底盘运动学模型分析

2022年危险化学品经营单位主要负责人复训题库及答案

VR panorama gold rush "careful machine" (Part 1)

科目三: 济南章丘五号线

【小样本分割】MSANet: Multi-Similarity and Attention Guidance for Boosting Few-Shot Segmentation
![Abstract intelligent extraction [based on Bert technology]](/img/1c/7c1b0e9bc9af62308f4124104f6110.png)
Abstract intelligent extraction [based on Bert technology]

Development of NFT digital collection system: Xiaoyi digital intelligence helps brands launch NFT with one click on the chain

微服务化解决文库下载业务问题实践
![[Code] sword finger offer 04 search in two-dimensional array](/img/7d/a6693bfd24af9d9587539dda458d27.png)
[Code] sword finger offer 04 search in two-dimensional array

centos如何安装mysqldump
随机推荐
【无标题】
Elastic认证考试:30天必过速通学习指南
Restful Fast Request 2022.2.2发布,支持批量导出文档
2022 retraining question bank and answers for main principals of hazardous chemical business units
每日一题:奇偶树
356页14万字高端商业办公综合楼弱电智能化系统2022版
微服务化解决文库下载业务问题实践
Golang发送邮件库email
2022年危险化学品经营单位主要负责人复训题库及答案
科目三: 济南章丘二号线
物联网智能家居项目---智能卧室
科目三: 济南章丘三号线
list模拟实现
Subject 3: Jinan Zhangqiu line 6
括号的最大嵌套深度
Framework learning journey: init process startup process
Ribbon-负载均衡原理及部分源码
H.265网页播放器EasyPlayer对外开放录像的方法
Golang jwt跨域鉴权
零基础小白也能懂的 Redis 数据库,手把手教你易学易用!