写法一:
<%
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
%>