asp 后台发送utf8转码短信

<!--#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
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值