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請求就可以,而且不需要依賴工具。