Hi,

I am sending the code.. I have removed the actual URL
and login informations. -:)
Am I doing anything wrong? 
I am using libwwwperl - 5.48

regards
-- Tusar
#!/usr/bin/perl
 
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use HTTP::Cookies;
 
 
$ua = LWP::UserAgent->new;
 
$cookie_jar =
HTTP::Cookies->new(AutoSave=>1,ignore_discard =>1 ,
file => 'cookies.txt');
my $req = HTTP::Request->new(POST => 'http://<some
url>');
  
$req->content_type('application/x-www-form-urlencoded');
  
$req->content('UserID=abc&Password=abc123&Submit=Submit');
 
# Pass request to the user agent and get a response
back

$res = $ua->request($req);

$debug=2;
 
if ($res->is_success) {
    print $res->as_string if ($debug > 1);
} else {
    print $res->error_as_HTML;
}
 
   #exit;
 
 
$cookie_jar->extract_cookies($res);
 
$req1=HTTP::Request->new(POST=>'http://<anothercgi>');
  
$req1->content_type('application/x-www-form-urlencoded');
$cookie_jar->add_cookie_header($req1);
$req1->content('name=abc&status=A');
 
$res1 = $ua->request($req1);

#print $req1->as_string; # here i do not see the
header
#exit;                   # Cookie: name=value;path=/
#print $res1->as_string;
#exit;
 
 
if ($res1->is_success) {
      print $res1->content; 
}
else {
      print "Bad luck this time\n";
}



=====
Tusar K Nayak
*************************************************
If a man is in doubt let another man come into the room with a loaded gun in hand.
Cell: 9810295501
Home: 6599159

________________________________________________________________________
For Stock Quotes, Finance News, Insurance, Tax Planners, Mutual Funds...
                Visit http://in.finance.yahoo.com/

Reply via email to