Mohancse07
04-05-2016, 08:31 AM
Hi Team,
I'm unable to get the Cookies returned for a http request send via VBA Macro. The request send to server successfully and returns the 200 code with proper headers & cookies in Fiddler.
But when running the same request in EXCEL VBA macro, it does not shows the "Cookies" and all other content as part of the response are displayed in the output.
Is there any way to enable the macro to retrieve/allow the cookies in the response. PFB, my sample request format used.
Please help me to resolve the issue.
Thanks
Request:
Set xobj = createobject(MSXML2.XMLHTTP)
strUrl = "url here"
xobj.Open "GET", strUrl, False
xobj.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
xobj.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xobj.SetRequestHeader "Authorization", "Basic <base 64 encoded text>"
xobj.Send
strCookie = xobj.GetAllResponseHeaders()
' strCookie = xobj.GetResponseHeaders("QCCSession") 'this is also not working
debug.print strCookie
Response:
Returns all response headers , except cookies which are part of the response
I'm unable to get the Cookies returned for a http request send via VBA Macro. The request send to server successfully and returns the 200 code with proper headers & cookies in Fiddler.
But when running the same request in EXCEL VBA macro, it does not shows the "Cookies" and all other content as part of the response are displayed in the output.
Is there any way to enable the macro to retrieve/allow the cookies in the response. PFB, my sample request format used.
Please help me to resolve the issue.
Thanks
Request:
Set xobj = createobject(MSXML2.XMLHTTP)
strUrl = "url here"
xobj.Open "GET", strUrl, False
xobj.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
xobj.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xobj.SetRequestHeader "Authorization", "Basic <base 64 encoded text>"
xobj.Send
strCookie = xobj.GetAllResponseHeaders()
' strCookie = xobj.GetResponseHeaders("QCCSession") 'this is also not working
debug.print strCookie
Response:
Returns all response headers , except cookies which are part of the response