T
tester
Hi All,
I am trying to automate login to a website using the following code. but
it is not working ... any ideas?
----------------------
use HTTP::Request;
use LWP::UserAgent;
$http_cmd = "http://testertesting:80/login.html";
my %tags = ();
$tags{'action'} = 'calling page/servlet';
$tags{'id'} = 'User';
$tags{'username'} = 'user';
$tags{'password'} = 'passwd';
# Create a user agent object
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");
# Create a request
my $req = HTTP::Request->new(POST => $http_cmd);
$req->content_type('application/x-www-form-urlencoded');
$req->content( %tags );
# Pass request to the user agent and get a response back
my $resp = $ua->request($req);
print $resp->content;
I am trying to automate login to a website using the following code. but
it is not working ... any ideas?
----------------------
use HTTP::Request;
use LWP::UserAgent;
$http_cmd = "http://testertesting:80/login.html";
my %tags = ();
$tags{'action'} = 'calling page/servlet';
$tags{'id'} = 'User';
$tags{'username'} = 'user';
$tags{'password'} = 'passwd';
# Create a user agent object
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");
# Create a request
my $req = HTTP::Request->new(POST => $http_cmd);
$req->content_type('application/x-www-form-urlencoded');
$req->content( %tags );
# Pass request to the user agent and get a response back
my $resp = $ua->request($req);
print $resp->content;