Solved

Programmatically logging into a site, using a FORM POST

Posted on 2003-11-06
2
677 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
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…

747 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

11 Experts available now in Live!

Get 1:1 Help Now