asp 後台發送utf8轉碼簡訊

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.