Solved

Programmatically logging into a site, using a FORM POST

Posted on 2003-11-06
2
683 Views
Last Modified: 2008-02-01
I'm trying to create an Internet Explorer instance which will login to Yahoo Groups programmatically.  Below is what I have.  Where {username} is a valid username, and {password} is the associated, valid password.  The final product should be an open instance of Internet Explorer displaying all my Yahoo Groups.

'--------------------------------------------

Dim obIE As SHDocVw.InternetExplorer
   
Set obIE = New SHDocVw.InternetExplorer
   
Call obIE.Navigate2("https://login.yahoo.com/config/login?.intl=us&.src=ygrp&.done=http://groups.yahoo.com%2F", , , "login={username}&password={password}")
   
Do Until obIE.readyState = READYSTATE_COMPLETE
    DoEvents
Loop

Call obIE.Navigate2("http://groups.yahoo.com/mygroups")
   
Do Until obIE.readyState = READYSTATE_COMPLETE
    DoEvents
Loop

obIE.Visible = True

'--------------------------------------------

Thank you in advance.
0
Comment
Question by:jessy_houle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 500 total points
ID: 9699236
Hi Jessy_Houle, I made a piece of code which will exactly do your thing.

Private Sub Form_Load()
    Dim ITEM As Variant
    Dim obIE As SHDocVw.InternetExplorer
    Dim obDC As HTMLDocument

    Set obIE = New SHDocVw.InternetExplorer
        obIE.Navigate "http://groups.yahoo.com/mygroups"
        obIE.Visible = True
  While obIE.Busy: DoEvents: Wend

    Set obDC = obIE.Document
    Do Until obDC.readyState = "complete"
        DoEvents
    Loop
   
    For Each ITEM In obDC.All.tags("input")
        'Fill in the username textbox
        If ITEM.Name = "login" Then ITEM.Value = "MyUsername"
        'Fill in the password textbox
        If ITEM.Name = "passwd" Then ITEM.Value = "MyPass"
    Next
   
    'Check the remember me checkbox if you wish
        obDC.All.ITEM(".persistent").Click
    'Click on Sign in
        obDC.All.ITEM(".Save").Click
        While obIE.Busy: DoEvents: Wend
End Sub

Happy programming,
Ayhan Elatik
0
 

Author Comment

by:jessy_houle
ID: 9701900
aelatik:

Great Job!  Thank you very much.  The reason that I need this in the first place is because of the ".persistent" issue.  My entire family uses the same computer (and NT User account), and each of us has different My Yahoo Groups.  If I check the persistent checkbox, then my wife and children will default to my groups, and vice versa.  This way, I can display a simple VB form to choose the person, and it will pop up their associated My Yahoo Groups page.

Thanks again.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

751 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