My VBA code send every headers except for Cookie information.
Dim oXMLHttpRequest As Object
Set oXMLHttpRequest = CreateObject("Microsoft.XmlHttp")
oXMLHttpRequest.setRequestHeader "Accept", "text/html, application/xhtml+xml, */*"
oXMLHttpRequest.setRequestHeader "Accept-Language", "ko-KR"
oXMLHttpRequest.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
oXMLHttpRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXMLHttpRequest.setRequestHeader "Accept-Encoding", "gzip, deflate"
oXMLHttpRequest.setRequestHeader "Connection", "Keep-Alive"
oXMLHttpRequest.setRequestHeader "DNT", "1"
oXMLHttpRequest.setRequestHeader "Cookie", "xxx=yyy"
oXMLHttpRequest.send[enter image description here][1]
As you see in the Capture link below, Cookie: xxx=yyy is missing.. I have no clue. Please help me. Thank you.
Fiddler capture:
There's a rumour on Google that you have to use the WinHTTP object here and not MSXML2. E.g.:
Option Explicit
Sub Test()
Dim objRequest As Object
Dim strResponse As String
Dim blnAsync As Boolean
Set objRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
blnAsync = True
With objRequest
.Open "POST", "http://www.comparity.net/perl/form.pl", blnAsync
.setRequestHeader "Cookie", "timtam=penguin"
.send
.WaitForResponse
strResponse = .responseText
Debug.Print strResponse
Debug.Print .Status
End With
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With