Link to home
Start Free TrialLog in
Avatar of TigerIBD
TigerIBD

asked on

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

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!
Avatar of Dave_Greene
Dave_Greene

<ping>
Avatar of TigerIBD

ASKER

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,
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
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.

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!
Avatar of Richie_Simonetti
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
Richie,
Thanks a lot for your input. I will give it try right now. I will let you know the outcome.

Tiger
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
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">
-------------------------------------------------
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).
ASKER CERTIFIED SOLUTION
Avatar of wsh2
wsh2

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
Works great, well done wsh2!
Excellent code! Thank you very much.
many many thanks goes to Richie and wsh2!!!
Many thanks to you for the points!
Cheers
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
I have reduced points to zero for this question so that I can split the points (TigerIBD's CS request.)

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

Richie_Simonetti https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=visualbasic&qid=20163046
Lunchy, Did you split the points for me already or should I need to do anything else at this point?

Please reply, Thanks.
Lunchy, I just accepted your proposed solution.
Thanks again.