Link to home
Start Free TrialLog in
Avatar of Sriburri73
Sriburri73

asked on

CAN SOME ONE HELP ME PLS>>>Log onto alternative site(say experst-exchange.com) using the userid and pwd entere in a form and return some text and image that you encounter first in that page

i tried using this code and could get to a point where i could get the text but dumbfounded how to retrieve and display the image.
i kept this code in a <script vbscript> and calling it on button click after user enters the userid and pwd on the ASP Page.Can some one help.

Dim ie ,doc
Dim password
Dim username
username = "username"
password = "password"

Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.Navigate2 (<URL here>)
Do While ie.Busy = True
    msgbox ("Click Ok to Send Your User Id and Password")
Loop
doc = ie.Document
ie.Document.All("login").Value = username
ie.Document.All("passwd").Value = password
ie.Document.All(".save").Click

set DocInnertext=ie.Document
msgbox(DocInnertext.body.innertext)
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Try using something like this:

Function GetHTML(strURL)
      Dim objXMLHTTP, strReturn
      Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
      objXMLHTTP.Open "GET", strURL, False
      objXMLHTTP.Send
      strReturn = objXMLHTTP.responseText
      Set objXMLHTTP = Nothing
      GetHTML = strReturn
End Function

FtB


Sorry, you need credentials--so:

Function GetHTML(strURL, strUserName, strPassword)
     Dim objXMLHTTP, strReturn
     Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
     objXMLHTTP.Open "GET", strURL, False, strUserName, strPassword
     objXMLHTTP.Send
     strReturn = objXMLHTTP.responseText
     Set objXMLHTTP = Nothing
     GetHTML = strReturn
End Function
Avatar of Sriburri73
Sriburri73

ASKER

I am getting an error
msxml3.dll error '80072ee6'

The URL does not use a recognized protocol

Let's see the code that you are running.

FtB
Dim objXMLHTTP, strReturn
     Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
     objXMLHTTP.Open "GET","http://login.yahoo.com/config/login?.done=http://finance.yahoo.com&.src=quote", False, "userName", "Password"
     objXMLHTTP.Send
     strReturn = objXMLHTTP.responseText
     response.write strReturn
     Set objXMLHTTP = Nothing
And instead of "userName", "Password" you are passing appropriate credentials?

FtB
Yeah I am using right credentials ..using the same user id and pwd i am able to login to the site using the code i pasted first..The only issue with the code was i am unable to get the images
Okay, one more test. What happens if you run this page?

<%
Function GetHTML(strURL)
     Dim objXMLHTTP, strReturn
     Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
     objXMLHTTP.Open "GET", strURL, False
     objXMLHTTP.Send
     strReturn = objXMLHTTP.responseText
     Set objXMLHTTP = Nothing
     GetHTML = strReturn
End Function

response.write(getHTML("http://www.FairfieldConsulting.com/index.asp"))

%>
i am able to run the script and got hte following output..

about us
coding services
web hosting
code corner
drop us a line
Fairfield Consulting is an Information Technology company that specializes in data-driven application design and internet services employing technologies including: ASP, SQL, ADO, VBScript, JavaScript, .NET, XML/XSL, and Visual FoxPro.

For over 11 years, we have been providing these services for clients including: The New England Organ Bank, The Massachusetts Society for the Prevention against Cruelty to Animals, Brandeis University, The Mind/Body Medical Institute (Beth Israel Hospital / Harvard Medical School) among others.

------------
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Fritz,

I tried the code you gave above with valid yahooid and pwd as shown below and its just bringing up the yahoo login screen.
Then I am guessing that the screen is not designed to allow this sort of automated login?

FtB
i am able to login to the same screen and was able to capture the text using the code i pasted initially (using SHDOCVW.DLL though)
I am not sure how much more I can help with this then. It is a bit of a bummer as this question has fallen rather far down the list, so I am not sure if it will receive much attention.

FtB

Thats ok Fritz.Thanks alot for the help..

I am new to Experts Exchange..If you can ,please loud  shout to other experts whom you know and can help me out with this one.Also if you know of sites where i can find more info on MSXML2 or SHDOCVW.DLL ,would be helpful too..

Thanks
Sorry that I couldn't do more.

FtB