首页 > 代码库 > vbs http

vbs http

get请求

模拟发送http请求到百度
Dim http
Set http = CreateObject("Msxml2.ServerXMLHTTP")
http.open "GET",http://www.baidu.com, False
http.send
msgbox http.status
msgbox http.responsetext

post请求

set Http=createobject("MSXML2.XMLHTTP")
Http.Open "POST", url, False
http.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
http.Send “str”
html =http.responsetext
msobox   html

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

vbs http