Solved

Auto logon to <a href=http://www.investors.com?>www.investors.com?</a>

Posted on 2001-08-01
20
296 Views
Last Modified: 2008-03-10
Hi, experts:

Do you know how to programmatically (VB/VBA/VBS) logon to a web site with Hidden field value?

I need your help to fix my code. I will send you [myLogonID] and [myPassword] if you drop me a line, my e-mail address is TigerIBD@yahoo.com

URL to get to the public login screen is http://www.investors.com/formslogin.asp

************************
my code is: http://www.investors.com/formslogin.asp/verifPwd.asp?htmUserName=myLogonID&htmPassword=myPassword
************************

-----------
You may write a solution based on:
VB or VBS or VBA or Excel Web Query
or Cookie function
or WebBrowser.Navigate
or whatever

Thank you in advance!
0
Comment
Question by:TigerIBD
  • 11
  • 4
  • 2
  • +2
20 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6342461
0
 
LVL 14

Expert Comment

by:wsh2
ID: 6342585
<ping>
0
 

Author Comment

by:TigerIBD
ID: 6342608
Dave,

Thank you for your prompt response. I just run the Encryption utility you mentioned.

myLogonID becames V6A59CXXXXXXXXXXXXXXXXXXXXXXXXXXXA2679CA13B

and
myPassword becames
V9BEF53XXXXXXXXXXXXXXXXXXXXXXXXXX9D6C68779A70

How do we proceed?

Thanks,
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6342618
Sorry, to "a" website... I thought this was a site you were working on.  Then you could take in the encrypted values and decrypt them in code.  If this is someone elses site, then this isn't going to get you anywhere
0
 

Author Comment

by:TigerIBD
ID: 6342665
Dave,

Thanks again for your reply. This website is a public accessible website on the Internet with paid subscription. I am an individual investor, I would like to download 50 different companies' stock quote and technical data on the daily basis. That's why I need VB code to save my time.

0
 

Author Comment

by:TigerIBD
ID: 6343266
Here is my e-mail address: TigerIBD@yahoo.com.
If you would like to write a new code, please drop me a line, I will send you myLogonID and myPassword.

Thanks a lot!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6346016
Give this a shot:
Set areference to microsoft HTML library and Internet controls library on a new project and paste this code in form1:

Option Explicit

Dim WithEvents Ie As InternetExplorer
Private Sub Form_Load()
Set Ie = New InternetExplorer
Ie.Visible = True
Ie.navigate "http://www.investors.com/formslogin.asp"
End Sub


Private Sub Ie_DocumentComplete(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Dim hdoc As HTMLDocument
Dim txt As HTMLInputElement
Dim btnGo As htmlInputImage

If (pDisp Is Ie) Then
    Set hdoc = Ie.document
    For Each txt In hdoc.All.tags("INPUT")
        If (txt.isTextEdit And txt.Name = "htmUserName") Then
            txt.Value = "username"  'Your choice
        ElseIf (txt.isTextEdit And txt.Name = "htmPassword") Then
            txt.Value = "password" 'Your choice
        End If
    Next
    For Each btnGo In hdoc.body.All
        If (btnGo.Name = "htmPage" And btnGo.Type = "hidden") Then
            btnGo.Click
        End If
    Next
   
End If
End Sub

Hope it helps
0
 

Author Comment

by:TigerIBD
ID: 6346311
Richie,
Thanks a lot for your input. I will give it try right now. I will let you know the outcome.

Tiger
0
 

Author Comment

by:TigerIBD
ID: 6346401
Richie,
You are a very intelligent person. Your program almost gets me there. Can you provide me your e-mail address, so I can send you my userID and password?

Would you please give it a try at your earliest convenient? Thank you in advance.

Tiger
0
 

Author Comment

by:TigerIBD
ID: 6346818
Richie,

Your program almost works except the "btnGo.Click".
------------------------------------------------
If (btnGo.Name = "htmPage" And btnGo.Type = "hidden") Then
    btnGo.Click
End If
------------------------------------------------

Would you please modify the above code? Thanks a lot!  

P.S.  The original website source code is:

<td BGCOLOR="#ffe59a" class="gryformsub"><input type=image alt="Go!" WIDTH="31" HEIGHT="20" src="http://www.investors.com/images/btnGo.gif" border="0" id=image2 name=image2></td>

<td width="1"><img src="http://www.investors.com/px.gif" height="1" width="1" alt="" border="0"></td>

</tr><input name="htmPage" type="hidden" value="http://www.investors.com/default.asp">
-------------------------------------------------
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6346881
Here is my e-mail:
richsimo@hotmail.com
I got the original web source code but i can't try it until tomorrow morning (Here is 8:00 PM now).
I would like to know what is the error with the last section of code (btngo.click).
0
 
LVL 14

Accepted Solution

by:
wsh2 earned 0 total points
ID: 6349160
Assisting Richue_Simonetti:

Set a reference to microsoft HTML library and Internet controls library on a new project and paste this
code in form1:

<----- Code Begin ----->

Option Explicit

Dim WithEvents Ie As InternetExplorer

Private Sub Form_Load()
   
   Set Ie = New InternetExplorer
   Ie.Visible = True
   Ie.Navigate "http://www.investors.com/formslogin.asp"

End Sub

Private Sub Ie_DocumentComplete(ByVal pDisp As Object, URL As Variant)
   
   On Error Resume Next
   Dim hdoc As HTMLDocument
   Dim txt As HTMLInputElement
   
   If (pDisp Is Ie) Then
      Set hdoc = Ie.Document
      If LCase(URL) = "http://www.investors.com/formslogin.asp" Then
         For Each txt In hdoc.All.tags("INPUT")
            Select Case UCase(txt.Name)
               Case "HTMUSERNAME"
                  txt.Value = "Username"  'Your choice
               Case "HTMPASSWORD"
                  txt.Value = "Password" 'Your choice
               Case "IMAGE2"
                  txt.Click
            End Select
         Next txt
      End If
   End If
   
End Sub


<----- Code End ----->



0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6349219
Works great, well done wsh2!
0
 

Author Comment

by:TigerIBD
ID: 6349344
Excellent code! Thank you very much.
0
 

Author Comment

by:TigerIBD
ID: 6349370
many many thanks goes to Richie and wsh2!!!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6349508
Many thanks to you for the points!
Cheers
0
 

Author Comment

by:TigerIBD
ID: 6349766
Richie and wsh2,

Here comes a new 100-points question for you.

After auto logon to www.investors.com site by using your program. How can you click one button to programmatically save 5 company's technical data to a local computer drive(For example, D:\IBD\) as HTML files.

---------------------
Here are the manual procedures to save [IBD power tools Stock checkup] web page:
1. logon to www.investors.com site
2. at [IBD power tools] area, type in Microsoft stock symbol "msft" without the quotes
3. click Go! button
4. from menu bar, click [File] -- [SaveAs...]
5. type in [d:\ibd\msft] as a File Name
6. click Save button

This saved file becames d:\ibd\msft.html

Repeat this process for the other 4 companies:
INTC       (Intel Company)
DELL       (Dell)
IBM        (IBM)
ORCL       (Oracle)

Thank you very much!
Tiger
0
 
LVL 2

Expert Comment

by:Lunchy
ID: 6350076
I have reduced points to zero for this question so that I can split the points (TigerIBD's CS request.)

wsh2 http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20163048

Richie_Simonetti http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20163046
0
 

Author Comment

by:TigerIBD
ID: 6350178
Lunchy, Did you split the points for me already or should I need to do anything else at this point?

Please reply, Thanks.
0
 

Author Comment

by:TigerIBD
ID: 6350232
Lunchy, I just accepted your proposed solution.
Thanks again.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Specify ip address in my connection string for sas 2 65
VBA to copy paste columns form one file to other 20 91
MsgBox 2 59
to transfer string from C lanaguage to VBA 4 72
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

829 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