Solved

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

Posted on 2004-09-15
16
570 Views
Last Modified: 2007-12-19
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)
0
Comment
Question by:Sriburri73
  • 9
  • 7
16 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12087464
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12087489


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
0
 

Author Comment

by:Sriburri73
ID: 12088325
I am getting an error
msxml3.dll error '80072ee6'

The URL does not use a recognized protocol

0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12088452
Let's see the code that you are running.

FtB
0
 

Author Comment

by:Sriburri73
ID: 12089776
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12091667
And instead of "userName", "Password" you are passing appropriate credentials?

FtB
0
 

Author Comment

by:Sriburri73
ID: 12094183
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12095306
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"))

%>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Sriburri73
ID: 12095610
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.

------------
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 500 total points
ID: 12095667
Okay, that is good. That means that you should be able to run the MSXML2.ServerXMLHTTP object.

So we are starting to narrow down the issue....

When I do this, it also works:
<%@ Language = VBSCRIPT %>
<% Option Explicit %>
<HTML>
<BODY>
<%
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

response.write(GetHTML("http://www.FairfieldConsulting.com/index.asp","fritz","blank"))
%>
</BODY>
</HTML>

So, that means there has to be something about the way that the site is handling this?

FtB

0
 

Author Comment

by:Sriburri73
ID: 12097990
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.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12098077
Then I am guessing that the screen is not designed to allow this sort of automated login?

FtB
0
 

Author Comment

by:Sriburri73
ID: 12098642
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)
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12102005
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

0
 

Author Comment

by:Sriburri73
ID: 12102709
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12102746
Sorry that I couldn't do more.

FtB
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Smart quotes being changed on insert 9 50
Prevent URL from printing on header 5 65
Want the count number from this QUery 2 38
If-Then-Else ASP problem 6 49
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now