views:

129

answers:

3

I want to write a script to log in and interact with a web page, and a bit at a loss as to where to start. I can probably figure out the html parsing, but how do I handle the login part? I was planning on using bash, since that is what I know best, but am open to any other suggestions. I'm just looking for some reference materials or links to help me get started. I'm not really sure if the password is then stored in a cookie or whatnot, so how do I assess the situation as well?

Thanks,

Dan

+4  A: 

Take a look a cURL, which is generally available in a Linux/Unix environment, and which lets you script a call to a web page, including POST parameters (say a username and password), and lets you manage the cookie store, so that a subsequent call (to get a different page within the site) can use the same cookie (so your login will persist across calls).

JacobM
+1  A: 

Search this site for screen scraping. It can get hairy since you will need to deal with cookies, javascript and hidden fields (viewstate!). Usually you will need to scrape the login page to get the hidden fields and then post to the login page. Have fun :D

Byron Whitlock
+1  A: 

I did something like that at work some time ago, I had to login in a page and post the same data over and over...

Take a look at here. I used wget because I did not get it working with curl.

Alberto Zaccagni
wget is also an option, certainly; I've done this with both. As I recall I found the cookie handling easier in curl, but both work well.
JacobM