vbs模拟http请求(get及post)

上一篇 / 下一篇  2013-11-30 16:13:27 / 个人分类:VBScript

,p @%z;on:T0get请求51Testing软件测试网'tD A-J/On

y'j%m Uu@uBN z0模拟发送http请求到百度51Testing软件测试网 ?E5ktQQ7l+G|#n:W
Dim http51Testing软件测试网cn4@t)U%W3{Wg
Set http = CreateObject("Msxml2.ServerXMLHTTP")51Testing软件测试网P Bz U aS4Hu5Z
http.open "GET",http://www.baidu.com, False51Testing软件测试网(YNr.b(dq'g
http.send51Testing软件测试网Q+Q^'|Q]
msgbox http.status51Testing软件测试网#qH3L OO:y;WD
msgbox http.responsetext

5fZ(V{ k/d9_051Testing软件测试网7[ a6tTTLY

post请求

U7u/Iax!Y)MD0

6@0Z0{}H\6Q9t0set Http=createobject("MSXML2.XMLHTTP")51Testing软件测试网Q Wj%{UaZ)x
Http.Open "POST", url, False51Testing软件测试网R'JMl(w'd
http.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
:R.IZ&S:P eT0http.Send “str”
yH3E c7y0html =http.responsetext
m.jd7pt,C4f0msobox   html

Vg?F1L0

2]uc"\Y6J dW0感受到vbs的强大,有时测试时,需要提交很多有字段的表单来造数据,用vbs直接发送http post请求就可以,而且不需要依赖工具。

zV0h$u!n+T*@6yB5I0

TAG:

 

评分:0

我来说两句

Open Toolbar