CodeNinja
10-08-2012, 01:52 PM
Hi Gang,
I have been working on a report collector that will download reports from the web. The program works, but takes a lot of time if I have a lot of reports to download. In an effort to make the code more efficient, I am looking to move some of the code from using an ie object to a get request using the xmlHTTP object.
The application is attached for your enjoyment, although I have not attached the udl file for security purposes.
My problem though, is that I cannot seem to get the xmlHTTP object to get past the password. When I run the following code, it returns the HTML of the page you would get if you did not enter the correct password.
I have tried putting the user ID and Password in the same line as the open statement:
.Open "get", sURL, False, "****", "****"
... but that gives me the same results as the code below, just returning the page as if I put in a wrong password or none at all.
Help would be greatly appreciated in figuring out how to get past the password stage and into html of the site.
Sub testGetHTML()
Dim sURL As String
Dim xh As XMLHttp
Dim sPostData As String
Set xh = New MSXML2.XMLHttp
sPostData = "Username=*****&Password=*****"
sURL = "http://hyattselectreports.lraqa.com//index.php?page=&propid=33809"
With xh
.Open "get", sURL, False
.send (sPostData)
Debug.Print .responseText
End With
End Sub
Thanks,
CodeNinja
I have been working on a report collector that will download reports from the web. The program works, but takes a lot of time if I have a lot of reports to download. In an effort to make the code more efficient, I am looking to move some of the code from using an ie object to a get request using the xmlHTTP object.
The application is attached for your enjoyment, although I have not attached the udl file for security purposes.
My problem though, is that I cannot seem to get the xmlHTTP object to get past the password. When I run the following code, it returns the HTML of the page you would get if you did not enter the correct password.
I have tried putting the user ID and Password in the same line as the open statement:
.Open "get", sURL, False, "****", "****"
... but that gives me the same results as the code below, just returning the page as if I put in a wrong password or none at all.
Help would be greatly appreciated in figuring out how to get past the password stage and into html of the site.
Sub testGetHTML()
Dim sURL As String
Dim xh As XMLHttp
Dim sPostData As String
Set xh = New MSXML2.XMLHttp
sPostData = "Username=*****&Password=*****"
sURL = "http://hyattselectreports.lraqa.com//index.php?page=&propid=33809"
With xh
.Open "get", sURL, False
.send (sPostData)
Debug.Print .responseText
End With
End Sub
Thanks,
CodeNinja