Home > php教程 > php手册 > ASP代码样例-S05GK接口发送短信

ASP代码样例-S05GK接口发送短信

WBOY
Release: 2016-06-06 19:39:30
Original
2148 people have browsed it

S05GK接口发送短信ASP代码样例 用ASP调用短信接口可以采用ASP的XMLHTTP对象的OPEN方法实现模拟POST提交发送,相关发送的信息如短信内容、接收号码等都通过POST方式提交。下面是摘自速达移动(sudas.cn)的接口样例文档中关于接口调用的代码。 %@LANGUAGE="VBSC

S05GK接口发送短信ASP代码样例
     用ASP调用短信接口可以采用ASP的XMLHTTP对象的OPEN方法实现模拟POST提交发送,相关发送的信息如短信内容、接收号码等都通过POST方式提交。下面是摘自速达移动(sudas.cn)的接口样例文档中关于接口调用的代码。

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Function Post(url,data)
	dim Https 
	set Https=server.createobject("MSXML2.XMLHTTP")
	Https.open "POST",url,false
	Https.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
	Https.send data
	if Https.readystate=4 then
		dim objstream 
		set objstream = Server.CreateObject("adodb.stream")
		objstream.Type = 1
		objstream.Mode =3
		objstream.Open
		objstream.Write Https.responseBody
		objstream.Position = 0
		objstream.Type = 2
		objstream.Charset = "utf-8"
		Post = objstream.ReadText
		objstream.Close
		set objstream = nothing
		set https=nothing
	end if
End Function

dim target,post_data
target = "http://sdk.sudas.cn/submitdata/Service.asmx/g_Submit"
post_data = "sname=&spwd=&scorpid=&sprdid=&sdst=&smsg="&Server.URLEncode("短信测试")

response.Write(Post(target,post_data))
''//请自己解析Post(target,post_data)返回的字符串并实现自己的逻辑
''<State>0</State>表示成功,其它的参考文档
%>

相关具体参数跟短信服务商沟通即可,其他HTTP接口也可以通过类似方式实现提交。
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template