日期:2014-05-16  浏览次数:20969 次

asp怎么调用Http短信接口呢?
现在有一个http短信接口:http://sdk.kuai-xin.com:8888/sms.aspx?action=send&userid=12&account=账号&password=密码&mobile=15023239810,13527576163&content=内容&sendTime=

在asp里要如何调用这个短信接口呢?以前没接触过asp求大家指点下,帮忙给个详细的代码,谢谢了!

------解决方案--------------------
Function getHTTPPage(url)
Dim Http
Set Http = Server.CreateObject("MSXML2.XMLHTTP")
Http.Open "GET", url, False
Http.send()
If Http.readystate <> 4 Then
Exit Function
End If
getHTTPPage = BytesToBstr(Http.responseBody, "GB2312")
Set Http = Nothing
If Err.Number <> 0 Then Err.Clear
End Function

Function BytesToBstr(body, Cset)
Dim objstream
Set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function

response.write getHTTPPage("http://sdk.kuai-xin.com:8888/sms.aspx?action=send&userid=12&account=账号&password=密码&mobile=15023239810,13527576163&content=内容&sendTime=")

直接传递那个网址进去就可以了
------解决方案--------------------
他返回来的值是xml格式的,你转换为xml的就可以使用xml的直接获取了
------解决方案--------------------
当然,你的是返回xml格式的,你可以直接

set xmlhttp=Server.CreateObject("MSXML2.XMLHTTP")
URL="http://sdk.kuai-xin.com:8888/sms.aspx?action=send&userid=12&account=账号&password=密码&mobile=15023239810,13527576163&content=内容&sendTime="
xmlhttp.open "POST",URL, False
xmlhttp.send 
       if xmlhttp.readyState = 4 then
     Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
     xmlDoc.loadXML(xmlhttp.responseText)
    Set item=xmlDoc.getElementsByTagName("returnsms")
    For i=0 To (item.Length-1)
     Set returnstatus=item.Item(i).getElementsByTagName("returnstatus")
     Set message=item.Item(i).getElementsByTagName("message")
     Response.Write returnstatus.Item(0).Text
     Response.Write message.Item(0).Text
     
    Next    
     end if
end if

自己调试吧