slloyd has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; print "Content-type: text/html\n\n"; $|++; use LWP; use HTTP; use HTTP; my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file=>'cookie_jar', autosave=>1)); my $r = $ua->simple_request(POST "http://www.somesite.com/Login.jsp", { requiredUserName => '123abc', requiredPassword => 'abc123', 'Submit' => 'Sign in', }); while ($r->is_redirect) { my $u = $r->header('location') or die "missing location: ", $r->as_string; print "redirecting to $u\n"; $r = $ua->simple_request(GET $u); } if ($r->is_success) { print $r->content; } else{ print "failed"; } exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with LWP on FreeBSD
by shotgunefx (Parson) on Apr 30, 2002 at 14:57 UTC | |
|
Re: Problems with LWP on FreeBSD
by slloyd (Hermit) on Apr 30, 2002 at 18:09 UTC | |
|
Re: Problems with LWP on FreeBSD
by pepik_knize (Scribe) on Apr 30, 2002 at 14:05 UTC |