+ Reply to Thread
Results 1 to 1 of 1

How to identify the session of the IE and use the same for the subsequent calls

Hybrid View

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Boston, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    How to identify the session of the IE and use the same for the subsequent calls

    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?
    Last edited by paranidharan; 11-29-2012 at 12:52 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1