日期:2014-05-17 浏览次数:20868 次
<% '============= 'POST发送短信 '建议一次最大提交5000个号码之内 '页面编码类型为:GB2312 '=============作用把中文转为urlcode Function URLEncoding(vstrIn) strReturn = "" For i = 1 To Len(vstrIn) ThisChr = Mid(vStrIn,i,1) If Abs(Asc(ThisChr)) < &HFF Then strReturn = strReturn & ThisChr Else innerCode = Asc(ThisChr) If innerCode < 0 Then innerCode = innerCode + &H10000 End If Hight8 = (innerCode And &HFF00)\ &HFF Low8 = innerCode And &HFF strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8) End If Next URLEncoding = strReturn End Function '================与网关通信过程 function getHTTPPage(strurl,data) on error resume next set http = Server.CreateObject("Msxml2.XMLHTTP") http.Open "POST",strurl, false http.setRequestHeader "Content-type:", "text/xml;charset=GB2312" Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" http.Send(data) getHTTPPage=http.ResponseText set http=nothing end function '=================发送短信 function sendsms(uid,pwd,mobiles,message) url="http://service.winic.org:8009/sys_port/gateway/?" sdata=URLEncoding("id="&uid&"&pwd="&pwd&"&to="&mobiles&"&content="&message&"&time=") binfo=getHTTPPage(url,sdata) '发送并把结果赋给binfo result1=split(binfo,"/") result3=split(result1(3),":") if result1(0)="000"then result2=split(result1(1),":") savesms mobiles,message,1,result3(1) response.write"<script type=""text/javascript"">alert('成功发送"&result2(1)&"条')</script>" else savesms mobiles,message,0,result3(1) response.write"<script type=""text/javascript"">alert('发送失败')</script>" end if end function%>