寫法一:
復(fù)制代碼 代碼如下:
%
Sub sendsms(mobile,msg)
'如需要發(fā)送多個(gè)手機(jī)號(hào),請(qǐng)自動(dòng)循環(huán),多個(gè)手機(jī)號(hào)之間用“,”分隔,最后手機(jī)號(hào)碼后不加,號(hào)
'或調(diào)用我們 HttpInterfaceMore.aspx 接口,后跟參數(shù)一樣或調(diào)用我們的webservers接口
dim userid,password,username,sms,status
dim xmlObj,httpsendurl
'請(qǐng)?zhí)韺懩馁~號(hào)密碼
sms="平臺(tái)"
username="用戶名"
userid = "企業(yè)ID"
password = "密碼"
請(qǐng)聯(lián)系我們索取免費(fèi)測(cè)試帳號(hào)
httpsendurl="http://jiekou.56dxw.com/sms/HttpInterface.aspx?
comid="userid"username="username"userpwd="password"handtel="mobile"
sendcontent="server.URLEncode(msg)"sendtime=smsnumber="sms
Set xmlObj = server.CreateObject("Microsoft.XMLHTTP")
xmlObj.Open "POST",httpsendurl,false
xmlObj.send()
status = xmlObj.responseText
Set xmlObj = nothing
If status = "1" then '發(fā)送成功
Response.Write "br>br>返回狀態(tài)碼:"status"nbsp;nbsp;nbsp;發(fā)送狀態(tài):發(fā)送成功!nbsp;nbsp;nbsp; a
href=""javascript:history.back();"">返回發(fā)送頁(yè)面/a>"
Else '發(fā)送失敗
Response.Write "br>br>返回狀態(tài)碼:"status"nbsp;nbsp;nbsp;發(fā)送狀態(tài):發(fā)送失??!nbsp;nbsp;nbsp;a
href=""javascript:history.back();"">返回發(fā)送頁(yè)面/a>"
End if
End sub
%>
寫法二
復(fù)制代碼 代碼如下:
%
Function SendSms(UserName, UserPass, DstMobile, SmsMsg)
Dim http,msg,strUrl,RndNumber
set http = Server.CreateObject("Microsoft.XMLHTTP")
strurl="http://jiekou.56dxw.com/sms/HttpInterface.aspx?comid=121username="SmsName"userpwd="SmsPw"
sendtime=smsnumber=1065handtel="DstMobile"sendcontent="server.URLEncode(SmsMsg)
http.Open "GET",strUrl, false
http.setRequestHeader "Content-type:", "text/xml;charset=GB2312"
http.Send
msg=http.ResponseText
set http = nothing
'代表發(fā)送成功
If msg="1" then
SendSms="OK"
else
sendSms="ERR"
end IF
End Function
%>