my $url = shift; my $ua = new LWP::UserAgent; $ua->timeout(20); $ua->agent('Automated agent'); # with cookie support... my $cookies = HTTP::Cookies->new(); $ua->cookie_jar($cookies); my $req = HTTP::Request->new(GET => $url); print STDERR "doing GET request to $url...\n"; my $res = $ua->request($req); my $content = $res->content; my $status = $res->status_line(); $ua->cookie_jar->extract_cookies($res);