PDA

Click to See Complete Forum and Search --> : Automating entry of UserID / Password to website from VB


Geoffrey Daniel
Dec 4th, 1999, 04:36 PM
Hi:

I'm trying to automate the daily downloading of data from a website that I conventionally get into by entering a userID then a password then hitting Enter (or clicking on the button).

I can't figure how to automate the entry of the userID into the field on the starting page, then the password, then hitting enter.

Can you help me figure this out, please? Once I'm in there, I want to pull the page down into my PC and extract certain data to add into a database in my PC.

Thx - Geoffrey Daniel

vbsquare
Dec 4th, 1999, 05:42 PM
Is the page an ASP page or an HTML page posting to a CGI script?

------------------
"To the glory of God!"

vbsquare
Dec 5th, 1999, 01:36 AM
OK. ASP stands for Active Server Pages (find more at www.activeserverpages.com) (http://www.activeserverpages.com)) and CGI stands for Common Gateway Interface. When writing a CGI script people mainly use a language called Perl (www.perl.com)

Anyway, it looks to me like you can use VB to execute the url that you gave me. I would suggest using the Inet control (see www.vbsquare.com/internet/): (http://www.vbsquare.com/internet/):)

b() = Inet1.OpenURL("https://www.retirelink.com/wconnect/wc.dll?DataServer~Checklogin~LOGIN~home.asp", icByteArray)

This sets the byte variable b to the output content of the url. To get readable results from b, do this:

For intCount = 0 To UBound(b)-1
strData = strData & Chr(b(intCount))
next

strData will now contain the output that you would see in your browser (well, it gives the source code of the output page)

------------------
"To the glory of God!"

Geoffrey Daniel
Dec 5th, 1999, 02:19 AM
Yes, and thanks, but how do I get through the UserName and Password steps first?

vbsquare
Dec 5th, 1999, 03:05 AM
From your description it would appear that it is an HTML form (although I can't get through with the link you gave me). The problem with HTML forms is that they submit to CGI scripts which reads variables that were passed from the HTML page in the form of the values you inputted to the text boxes etc.

What you need to do first is to goto the login page in your browser, view the source and look at the <input> tags. Make a note of their names, and the use the following to post data to the script:

b() = Inet1.OpenUrl("http://www.myurl.com/myscript.dll?userid=myuserid&password=mypassword", icByteArray)

Now use the code I gave earlier to get the response from the web site.

------------------
"To the glory of God!"

Geoffrey Daniel
Dec 5th, 1999, 11:58 AM
I don't know what as ASP is, but I believe it's an HTML page. As for CGI, I don't know how I would know what technology the site is using for this particular page. In case it helps - perhaps you could take a look at it, it's "https://www.retirelink.com/wconnect/wc.dll?DataServer~Checklogin~LOGIN~home.asp"

Wow - must be an asp (whatever that is!).

- Geoffrey