Jishnu Surendran
New Member
- Joined
- Jul 29, 2013
- Messages
- 32
I would want to login to a website using xmlhttprequest. My code is
Dim xmlreq As New MSXML2.XMLHTTP60
Dim htmldoc As New MSHTML.HTMLDocument
Dim htmlmsg As MSHTML.IHTMLElement
xmlreq.Open "GET", "https://yyy.com/main.php?pid=406&action=zz", False, "user", "password"
xmlreq.send
htmldoc.body.innerHTML = xmlreq.responseText
Set htmlmsg = htmldoc.getElementById("search-btn")
Debug.Print htmlmsg.innerText
This code is not getting me past the login page, stuck in there. Apart from the 'username' and 'password', I would need to provide a third field which is a dropdown selection before submitting.
I do not know how to pass this field to my code. Below is a screenshot of the login form.
Dim xmlreq As New MSXML2.XMLHTTP60
Dim htmldoc As New MSHTML.HTMLDocument
Dim htmlmsg As MSHTML.IHTMLElement
xmlreq.Open "GET", "https://yyy.com/main.php?pid=406&action=zz", False, "user", "password"
xmlreq.send
htmldoc.body.innerHTML = xmlreq.responseText
Set htmlmsg = htmldoc.getElementById("search-btn")
Debug.Print htmlmsg.innerText
This code is not getting me past the login page, stuck in there. Apart from the 'username' and 'password', I would need to provide a third field which is a dropdown selection before submitting.
I do not know how to pass this field to my code. Below is a screenshot of the login form.