RE: Logging in to form based log in page

> -----Original Message-----
> From: Kenny G. Dubuisson, Jr. [mailto:kdubuisson@kcmria.com]
> Sent: Tuesday, July 09, 2002 7:59 AM
> To: libwww@perl.org
> Subject: Logging in to form based log in page
> 
> 
> Hello all.  I'm trying to write a script that logs in to a 
> web page that has the user name and password input boxes as 
> part of the initial web page.  I've tried doing a "POST" with 
> the user name and password declarations and values in the 
> request to no avail.  Here is my code:

[snipped]

Hi Kenny;

Try something like this.This should get you started.
hope this helps :-)

Ron Hill

use strict;
use HTTP::Request::Common;
use HTML::Form;
use LWP::UserAgent;
use LWP::Debug qw(+);
use HTTP::Cookies;

my $ua = LWP::UserAgent->new();

$ua->agent("Automation/0.1");
$ua->cookie_jar(
  HTTP::Cookies->new( autosave => 1 ));

my $request = $ua->request( POST
'http://online.wsj.com/login?URI=%2Fdocuments%2Fdatabank.htm');

my $form = HTML::Form->parse( $request->content, $request->base());
print $form->dump;
$form->value( 'Login',   "xyz" );
$form->value( 'Password', "123" );

my $response = $ua->request( $form->click() );

print $response ->as_string;
0 ronald 7/9/2002 4:13:15 PM
Reply:

(Thread closed)