How to use VBS to send HTTP request with Cookie
This article mainly introduces how to use VBS to send HTTP requests with cookies. The article is very detailed and has certain reference value. Interested friends must read it!
To test this, write a simple PHP program that echoes cookies:
The code is as follows:
Then test with ServerXMLHTTP and XMLHTTP respectively:
The code is as follows:
Dim http
Set http = CreateObject("Msxml2.XMLHTTP")
http.open "GET", "http://demon.tw/test/cookie.php", False
http.SetRequestHeader "Cookie", "user=demon; passwd=123456"
http.send
WScript.Echo http.responseText
Nothing is returned with Msxml2.XMLHTTP.
The code is as follows:
Dim http
Set http = CreateObject("Msxml2.ServerXMLHTTP")
http.open "GET", "http://demon.tw/test/cookie.php", False
http.SetRequestHeader "Cookie", "user=demon; passwd=123456"
http.send
WScript.Echo http.responseText
Return with Msxml2.ServerXMLHTTP
user => demon
passwd => 123456
The above is "How to use VBS to send HTTP requests with cookies" All the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!