Heya Jeff,
You might consider HTTP::Cookies. You can use it with LWP by telling
the useragent to use a new cookie object to grab cookies from the HTML
headers. You'll get a lot more from perldoc HTTP::Cookies, but
following is an example,
Cheers,
C.J.
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Cookies;
my $ua = new LWP::UserAgent;
$ua->cookie_jar(HTTP::Cookies->new(file => 'cookie_jar', autosave => 1));
my $url = "http://foo.com/bar.html";
$url = $ARGV[0] if(@ARGV);
my $res = $ua->simple_request(GET $url);
while ($res->is_redirect) {
my $url = $res->header('location') or
die "missing location: ", $res->as_string;
print "redirecting to $url\n";
$res = $ua->simple_request(GET $url);
}
print $res->as_string, "\n", $ua->cookie_jar->as_string(), "\n";
> Hi,
>
> How do i go about accepting a cookie from a web login site?
>
> I use LWP to do a POST, but i can't login as the server
> sends a cookie. Is there a generic Login perl script lines?
>
> Login to a web site, send username password, accept cookie
> then the rest of the POST forms send that cookie back?
>
> Thanks
> Jeff.