ASP模拟POST提交数据的方法

来源:飘易 时间:2010-01-14 20:06:00 

有时需要获取远程网站的某些信息,而服务器又限制了GET方式,只能通过POST数据提交,这个时候我们可以通过asp来实现模拟提交post数据,飘易加工了下面的部分代码,比如获取IP138的IP数据地址信息,代码如下:

<%
On error resume next '容错处理
Function GetBody(ips) '飘易-获取远程IP地址POST信息
Set https = Server.CreateObject("MSXML2.XMLHTTP") 
With https 
.Open "Post", "http://www.ip138.com/ips8.asp", False
.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
.Send "ip="&ips&"&action=2"
GetBody = .ResponseBody
End With 
GetBody = BytesToBstr(GetBody,"GB2312")
Set https = Nothing 
End Function
Function BytesToBstr(body,Cset) '转换GB2312
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 GetBody("61.186.177.105")
%>

标签:xmlhttp,post,ip
0
投稿

猜你喜欢

  • 简单谈谈php延迟静态绑定

    2024-06-05 15:42:33
  • JS控件ASP.NET的treeview控件全选或者取消(示例代码)

    2024-06-23 17:53:53
  • python人工智能tensorflow函数tf.nn.dropout使用方法

    2023-11-16 17:45:44
  • Python反射机制案例超详细讲解

    2022-08-06 16:24:53
  • 利用Python和OpenCV库将URL转换为OpenCV格式的方法

    2021-08-10 13:41:43
  • Access数据库导入Mysql的方法之一

    2023-11-17 12:41:41
  • golang 实现tcp转发代理的方法

    2023-08-06 02:46:55
  • MySQL5.7中的sql_mode默认值带来的坑及解决方法

    2024-01-25 08:34:29
  • python interpolate插值实例

    2022-05-06 08:20:37
  • 让插入到 innerHTML 中的 javascript 跑起来

    2008-07-01 13:14:00
  • Python实现进程同步和通信的方法

    2023-08-30 04:21:45
  • Apache2 httpd.conf 中文版

    2023-10-28 04:19:38
  • python config文件的读写操作示例

    2022-04-05 07:42:11
  • Myeclipse链接Oracle等数据库时lo exception: The Network Adapter could not establish the connection

    2023-07-19 12:40:02
  • python中requests库session对象的妙用详解

    2021-10-30 14:42:58
  • UCenter 批量添加用户的php代码

    2024-05-11 09:25:09
  • python3.6 +tkinter GUI编程 实现界面化的文本处理工具(推荐)

    2023-07-07 01:18:03
  • pandas按条件筛选数据的实现

    2021-10-04 03:07:54
  • php Exception异常处理详解

    2023-05-29 21:51:37
  • Python解决pip install时出现的Could not fetch URL问题

    2023-08-01 14:24:45
  • asp之家 网络编程 m.aspxhome.com