Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Programmatically logging into a site, using a FORM POST

Posted on 2003-11-06
2
Medium Priority
?
694 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 1500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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