vbs發送請求

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章