my $ua = LWP::UserAgent->new( 'agent' => basename($0), 'timeout' => $TIMEOUT, ); my $cookie_jar = HTTP::Cookies->new( file => "perlcookie.txt", autosave => 1, ignore_discard => 1, ); $ua->cookie_jar( $cookie_jar ); my $client = REST::Client->new( { host => $url, timeout => 10, useragent => $ua, follow => 1, } ); $client->addHeader ("content-type", 'application/x-www-form-urlencoded'); $res = $client->POST( "j_security_check", "j_username=$username j_password=$password", ); print Dumper ($res); $res = $client->GET("api/14/system/info"); $rc = $client->responseCode (); print Dumper ($res); exit ( $rc);