0

I'm trying to get some data from a website in order to update an excel sheet.

I have managed to do it by using an internet explorer object but it is slow.
I'm now trying to do it using either an xmlhttp request or a winhttp request or the fastest of these two if one of them is faster. Or anything faster than an IE object.

The context :
To acces the data I need there are multiples forms I need to fill after logging in.

The website follow this path.

Url 1 > Login page
Url 2 > First form(Chose country)
Url 2 > Loads then, Another form(Bike or Car)
And so on. I have 4 form to fill and 3 url before having access to the data. Each form is dependent of the previous one. In order to simplify for now let's say I want to navigate a fixed path.
I think the website use frames as the url stay the same but the page loads another form & another style after selecting the value of the first form.

I'm lost here.
I have managed to get the page after the log in using a POST. but can't navigate within the site after. When I try to GET any of the subsequent pages I need, I'm getting the login page as response text. Same for POST to a form.

My ideas:

  • Storing the login cookie ? I did that :

    strCookie = xml.getResponseHeader("Set-Cookie")
    ...
    .setRequestHeader "Cookie", strCookie


>It does not work.

  • Calling the last page where the data is with all forms data in my POST
    >Gives me the page after the login as responsetext

Questions :
1) Where should I look at in order to do what I want?
2) Are the website frames a problem ? This may sound stupid but, how can they have two different pages at the same url ?
3) How can the previous form value be stored and where ?
4) I saw these 3 threads, and I'm confident they have the solution. It's a shame I don't understand them.
VBA Macros MSXML2.XMLHTTP Login
Login into website using MSXML2.XMLHTTP instead of InternetExplorer.Application with VBA
VBA XMLHTTP Pagination Issue - Can't get past the second page of search results

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
a1a1a1a1a1
  • 151
  • 12
  • You're going to have to learn how to `Parse and store the __VIEWSTATE, __VIEWSTATEGENERATOR, __EVENTVALIDATION from the HTML response` That 's the key to these types of pages – dbmitch May 11 '18 at 18:54
  • Is it possible to reduce the above to one question (address other questions in later posts)? Focus on where your code is stuck currently, post that code and describe what is happening and what you want to happen. It might be easier to see where the problem lies that way. And of course still include what you tried in relation to that one problem and what happened. – QHarr May 11 '18 at 19:27
  • No such thing as__VIEWSTATE, __VIEWSTATEGENERATOR, __EVENTVALIDATION on the website i'm trying to make the request on. I Ended up removing everything except the first GET and Debug.Print html.body.innerHTML.getElementById("__VIEWSTATE").value. It doesn't find anything. Any other suggestion ? – a1a1a1a1a1 May 11 '18 at 20:25
  • However I found some javax.faces.ViewState. Could it be that ? – a1a1a1a1a1 May 11 '18 at 20:41
  • Have you tried examining with Postman or Fiddler to see what traffic is being passed ? – QHarr May 12 '18 at 07:28
  • I'm dowloading it. I made a bit of progress yesterday, now I manage to GET the page of where the first form is. – a1a1a1a1a1 May 12 '18 at 08:21
  • 1
    Solved. Fiddler helped a lot. And it does was javax.faces.viewstates. – a1a1a1a1a1 May 12 '18 at 18:13
  • 1
    Please remember to post an answer so others can learn. Including anything that fiddler highlighted that helped you would be beneficial to future readers. – QHarr May 12 '18 at 18:28
  • The solution was. use fiddler to fill the form with the right parameters.I'm not realy a programmer. – a1a1a1a1a1 May 12 '18 at 19:38

0 Answers0