寫法一:
復制代碼 代碼如下:
<%
Sub sendsms(mobile,msg)
'如需要發送多個手機號,請自動循環,多個手機號之間用“,”分隔,最後手機號碼後不加,號
'或調用我們 HttpInterfaceMore.aspx 接口,後跟參數一樣或調用我們的webservers接口
dim userid,password,username,sms,status
dim xmlObj,httpsendurl
'請添寫您的賬號密碼
sms="平台"
username="用戶名"
userid = "企業ID"
password = "密碼"
請聯系我們索取免費測試帳號
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 '發送成功
Response.Write "<br><br>返回狀態碼:"&status&" 發送狀態:發送成功! <a
href=""javascript:history.back();"">返回發送頁面</a>"
Else '發送失敗
Response.Write "<br><br>返回狀態碼:"&status&" 發送狀態:發送失敗! <a
href=""javascript:history.back();"">返回發送頁面</a>"
End if
End sub
%>
寫法二
復制代碼 代碼如下:
<%
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=121&username="&SmsName&"&userpwd="&SmsPw&"
&sendtime=&smsnumber=1065&handtel="&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
'代表發送成功
If msg="1" then
SendSms="OK"
else
sendSms="ERR"
end IF
End Function
%>