I'm working on validating user (using web scraping) and when successful have to make a call to a service to get the data to populate the spreadsheet cells.
Using macro to validate the user by the means of below code (newly written), I can login and establis
..
set ie = createObject("InternetExplorer.Application")
ie.visible = true
ie.navigate url
form.username.value = xxx
form.password.value = yyy
doc.forms(0).submit
After this code, I need to call a service (already written code)
..
Dim http as MSXML2.XMLHTTP
Dim inputXML as String
inputXML = "<code></code>"
http.open "post", url, false
http.setRequestHeader "content-type", "application/xml"
http.send inputXML
..
Here the same session which I established using 1st piece of code is not passed on to the second call. How can I make the XMLHTTP code understand the user is already logged in.
I tried capturing the cookie from the IE shell and used it in the setRequestHeader, but unsuccessful.
..
http.open "post", url, false
http.setRequestHeader "content-type", "application/xml"
http.setRequestHeader "Cookie", "cookie1=test1"
http.setRequestHeader "Cookie", "cookie2=test2"
http.send inputXML
..
Any suggestions?
Bookmarks