use strict; use WWW::Mechanize; my $url = 'http://host:7777/fagcs_302_C600_sfosun05/domain/'; #my $url = 'http://host:7778/fagcs_320_C106_sfoaix04/domain/'; my $username = 'usrname'; my $password = 'pswd'; my $agent = WWW::Mechanize->new(); $agent->get ($url); #print $agent->content(); if($agent->success()){ eval { $agent->submit_form ( form_number => 0, fields => { 'j_username' => $username, 'j_password' => $password, }, ); }; if ($@) {print "error :($@) "; } print "Couldn't submit form:".$agent->status() .":".":".$agent->content()."\n" unless $agent->success; }