Set req = CreateObject("WinHttp.WinHttpRequest.5.1")
'Prevent the WinHttpRequest object from automatically following redirects.
Const WinHttpRequestOption_EnableRedirects = 6
req.Option(WinHttpRequestOption_EnableRedirects) = False
'Changing the user agent string
req.Option(WinHttpRequestOption_UserAgentString) = "Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101"
req.open "POST", "http://1.2.3.4/login"
DATA_POST = "name=huypv&password=zz&lang=vi"
req.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
req.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8"
req.setRequestHeader "Content-Length", Len(DATA_POST)
req.setRequestHeader "Referer", "http://phungvanhuy.net/auto/bot"
req.send DATA_POST
On Error Resume Next
GOT_COOKIE = req.GetResponseHeader("Set-Cookie")
Title:
VBS Send HTTP Request, get cookie
Description:
Set req = CreateObject("WinHttp.WinHttpRequest.5.1") 'Prevent the WinHttpRequest object from automatically following redirect...
...
Rating:
4