<!--#include file="../yy_oledb/yy3668_main.asp"-->
<%call Creat_odb("","")
dim u_1,u_2
Dim url,host,snum,dll,sms(4),men_v,xml,Stat,ecid,pass,sents
Dim b0,b1,b2,b3,b4,b5,c:b5=0
url=Re_format("SMS","Server_url")
host=Re_format("SMS","Server_host")
ecid=Re_format("SMS","Ecid")
pass=Re_format("SMS","ApplicationID")
snum=Re_format("SMS","Sms_num")
if(snum="")then snum="5":call Se_format("SMS","Sms_num",snum) end if
set b1=Read_odb("xh,Sms_num,Sms_code,User_tel,Bz,Parent_xh","SMS_SEND where parent_lx=0 and lx=0 and state=0")
do while not b1.eof
b2="srcmobile="&ecid&"&password="&pass&"&objmobile="&b1(3)&"&smsid="&b1(2)&"&smstext="&UTF8EncodeURI(b1(4))
b4=b1(0)
url=url&"?"&b2
call send_message(b2,b4,url)
'''b3=Send_post("GET",url,false,host,"",b2)
b1.MoveNext
loop
b1.close
Close_odb()
function send_message(v0,v1,v2) ''''发送短信并且对返回值处理
if snum>b5 then
b3=Send_post("GET",v2,false,host,"",v0)
b5=b5+1
end if
if((b3=1)and(snum>b5))then
call send_message(b2,b4)
elseif(b3=0)then ''''发送成功,修改SMS_SEND表状态位
call Update_odb("state=1 where xh="&v1&"","SMS_SEND")
b5=0
else
b5=0
end if
end function
Function UTF8EncodeURI(szInput) '''''''进行utf8转码
Dim wch, uch, szRet
Dim x
Dim nAsc, nAsc2, nAsc3
If szInput = "" Then
UTF8EncodeURI = szInput
Exit Function
End If
For x = 1 To Len(szInput)
wch = Mid(szInput, x, 1)
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
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
UTF8EncodeURI = szRet
End Function
%>