[snipped]
>
> Ron:
>
> You code worked well. I just have one question...how do I
> get the final
> page that I was supposed to be redirected to once I logged
> in. Below is the
> code I tried with the goal of having the final web page text
> in the temp
> HTML file; what I get now seems to be the cookie data. I tried
> "$response->content" also but it was empty.
[more snippage]
> > use strict;
> > use HTTP::Request::Common;
> > use HTML::Form;
> > use LWP::UserAgent;
> > use LWP::Debug qw(+);
> > use HTTP::Cookies;
BEGIN {
local $^W = 0;
*LWP::UserAgent::redirect_ok = sub {1}
}
silly me, I forgot to tell LWP to follow redirects :-(
> >
> > my $ua = LWP::UserAgent->new();
> >
> > $ua->agent("Mozilla/4.73");
> > $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;
however, this still does not work :-( it gets stuck during one of the
redirects.
I supect that the script needs to select the correct submit button.
(dump of the form)
URI= (hidden)
From=wsjauth (hidden)
Login=<UNDEF>
Password=<UNDEF> (password)
<NONAME>=Log In (submit)
<NONAME>=Log In (submit)
save_wsjie_login=<UNDEF> (checkbox) [*<UNDEF>|yes]
by default HTTP::Form will select the first submit button but the form
contains 2 of them
and I have no idea how to tell HTTP::Form to click the second one ( since
they both have no name).
If anyone has a way to do this I would like to know :-)
I hope this helps
Ron Hill