asp短信接口源码 比较简单但也挺实用用的(两个写法)
写法一:
写法二
代码如下:
<% 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 %>
相关推荐
瓜牛呱呱 2020-11-12
柳木木的IT 2020-11-04
yifouhu 2020-11-02
lei0 2020-11-02
源码zanqunet 2020-10-28
源码zanqunet 2020-10-26
一叶梧桐 2020-10-14
码代码的陈同学 2020-10-14
lukezhong 2020-10-14
lzzyok 2020-10-10
anchongnanzi 2020-09-21
clh0 2020-09-18
changcongying 2020-09-17
星辰大海的路上 2020-09-13
abfdada 2020-08-26
mzy000 2020-08-24
shenlanse 2020-08-18
zhujiangtaotaise 2020-08-18
xiemanR 2020-08-17