my $ua = LWP::UserAgent->new(); push @{ $ua->requests_redirectable }, 'POST'; my $cookies = new HTTP::Cookies(file=>'/Users/jcabraham/.cookies.txt',autosave=>1, ignore_discard=>1); $ua->cookie_jar($cookies); $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable()); $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return }); # log off first, just start clean my $auth_response = $ua->request(GET "http://ap1492-dsr/LogOff.php"); # now login my $response = $ua->request(POST "http://ap1492-dsr/authenticate.php", [user => $authUser, password => $authPw, TimezoneOffset => 14400, submit => 'User Login']); # scrape home page $response = $ua->request(GET "http://ap1492-dsr/Welcome.php"); if ($response->is_success) { my $html = $response->decoded_content; print $html; } #### macbook:scripts jcabraham$ link_aperio.pl 12 12 GET http://ap1492-dsr/LogOff.php Accept-Encoding: gzip, x-gzip, deflate, x-bzip2 User-Agent: libwww-perl/5.837 Cookie: PHPSESSID=1342557122; DontShowDisclaimer80=1 Cookie2: $Version="1" (no content) HTTP/1.1 302 Found Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: close Date: Thu, 19 Jul 2012 20:23:13 GMT Pragma: no-cache Location: Login.php Server: Apache Content-Length: 0 Content-Type: text/html; charset=UTF-8 Expires: Thu, 19 Nov 1981 08:52:00 GMT Client-Date: Thu, 19 Jul 2012 20:23:13 GMT Client-Peer: 10.100.50.80:80 Client-Response-Num: 1 X-Powered-By: PHP/5.3.5 (no content) GET http://ap1492-dsr/Login.php Accept-Encoding: gzip, x-gzip, deflate, x-bzip2 User-Agent: libwww-perl/5.837 Cookie: PHPSESSID=1342557122; DontShowDisclaimer80=1 Cookie2: $Version="1" (no content) HTTP/1.1 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: close Date: Thu, 19 Jul 2012 20:23:13 GMT Pragma: no-cache Server: Apache Content-Length: 5078 Content-Type: text/html; charset=UTF-8 Expires: Thu, 19 Nov 1981 08:52:00 GMT Client-Date: Thu, 19 Jul 2012 20:23:14 GMT Client-Peer: 10.100.50.80:80 Client-Response-Num: 1 Link: <./CSS/masterstyle.css?11.1.1.760>; rel="stylesheet"; type="text/css" Link: <./CSS/blue.css?11.1.1.760>; rel="stylesheet"; type="text/css" Link: <./CSS/blueLogin.css?11.1.1.760>; rel="stylesheet"; type="text/css" Link: <./CSS/custom.css?11.1.1.760>; rel="stylesheet"; type="text/css" Refresh: text/html Set-Cookie: memory_limit=deleted; expires=Wed, 20-Jul-2011 20:23:12 GMT; path=/ Set-Cookie: PHPSESSID=1342729393; path=/ Set-Cookie: PHPSESSID=681877b8eaa1b7fd3a35cc9db713cfa7; path=/ Set-Cookie: PHPSESSID=1342557122; path=/; httponly Title: Spectrum - Login X-Powered-By: PHP/5.3.5 \r Spectrum - Login