当前位置:网站首页>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)
%>
边栏推荐
- First pass of routing strategy
- JMeter学习笔记004-CSV文件行数控制循环次数
- 大咖说·图书分享|精益产品开发:原则、方法与实施
- js修改对象数组的key值
- NFT digital collection system development: old brand literary magazines play with trendy Digital Collections
- 细说Hash(哈希)
- JS to realize page Jump and parameter acquisition and loading
- Elastic认证考试:30天必过速通学习指南
- Navicat将MySQL导出表结构以及字段说明
- JMeter interface test (login, registration)
猜你喜欢

Summer meal | rich people are different from what you think (day 5) + power system power flow simulation (documents and matlab code)

Parallels Desktop启动虚拟机“操作失败”问题解决

Golang sends email to the mail Library

452 pages, 130000 words, the overall solution of modern smart Township Xueliang project 2022 Edition

Startup process and rescue mode

PSINS工具箱中轨迹生成工具详细解析

「Gonna Be Alright 会好的」数藏现已开售!感受艺术家的心灵共鸣

Golang发送邮件库email
![[Code] sword finger offer 04 search in two-dimensional array](/img/7d/a6693bfd24af9d9587539dda458d27.png)
[Code] sword finger offer 04 search in two-dimensional array

Nacos启动与登录
随机推荐
Using LCD1602 to display ultrasonic ranging
Leetcode:433. minimal genetic change
Which securities company has the lowest handling charge? Is it safe to open an account on your mobile phone
知识图谱:知识表示
Ant JD Sina 10 architects 424 page masterpiece in-depth distributed cache from principle to practice pdf
对NIO的初步理解
Big talk · book sharing | lean product development: principles, methods and Implementation
356页14万字高端商业办公综合楼弱电智能化系统2022版
xxx is not in the sudoers file. This incident will be reported
JMeter interface test (login, registration)
"Gonna be right" digital collection is now on sale! Feel the spiritual resonance of artists
spark练习案例(升级版)
Subject 3: Jinan Zhangqiu line 3
DINO 论文精度,并解析其模型结构 & DETR 的变体
CloudCompare&PCL 匹配点中值(或标准差)距离抑制
Nacos启动与登录
Collating strings
JMeter download and installation
PSINS工具箱中轨迹生成工具详细解析
括号的最大嵌套深度