Home: Perl Programming Help: Advanced:
Information retrival from password protected site



benliong
Deleted

Nov 27, 2000, 12:15 AM


Views: 1711
Information retrival from password protected site

I wrote a script to grap certain information from some site (say stock quotes). But the site requires me to log into the system before I can access those information. Now is there a way to have perl act as me, login using my username and password and then get the info?

Thanks in advance.

--Ben.


sleuth
Enthusiast

Nov 29, 2000, 10:04 PM


Views: 1711
Re: Information retrival from password protected site

 
If there is a form yes, you can automate it. Just get to the login page, view the source, grab the <form action="url URL url"> get the url from there, then collect all of the hidden values together, and say the text box name for the username is "user" and password is "pass". put those after the form action url. like this.

Form:

<form action="http://www.site.com/script.cgi" method="POST">
<input type="text" name="user">
<input type="text" name="pass">
<input type="HIDDEN" name="anything" value="54">
</form>

To automate that have your script fetch the information from the url:
http://www.site.com/script.cgi?user=YOURUSERNAME&pass=YOURPASSWORD&anything=54

See what I mean?

Sleuth