ASP模拟POST提交数据的方法

ASP模拟POST提交数据的方法

Author:flymorn Source:飘易
Categories:Asp编程 PostTime:2009-4-7 13:21:40
文:
有时需要获取远程网站的某些信息,而服务器又限制了GET方式,只能通过POST数据提交,这个时候我们可以通过asp来实现模拟提交post数据,飘易加工了下面的部分代码,比如获取IP138的IP数据地址信息,代码如下:
<%
Onerrorresumenext'容错处理

FunctionGetBody(ips)'飘易-获取远程IP地址POST信息
Sethttps=Server.CreateObject("MSXML2.XMLHTTP")
Withhttps
.Open"Post","http://www.ip138.com/ips8.asp",False
.setRequestHeader"Content-Type","application/x-www-form-urlencoded"
.Send"ip="&ips&"&action=2"
GetBody=.ResponseBody
EndWith
GetBody=BytesToBstr(GetBody,"GB2312")
Sethttps=Nothing
EndFunction

FunctionBytesToBstr(body,Cset)'飘易:转换GB2312
dimobjstream
setobjstream=Server.CreateObject("adodb.stream")
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing
EndFunction

Response.WriteGetBody("61.186.177.105")
%>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值