Hi:
I am new to Perl. I need to write a Perl page on the server that
will do an auto login to a site. I have got the following code. It
works for the first page, but on subsequent page, user is prompted for
credential again. I suspected the issue has something to do with
cookies. I want to pass the header from the secure site to the
client, but I don't know how to do it. May be I approached the
problem the wrong way. Thanks for the help.
use LWP;
use CGI;
# get input parameters
my $user = "user1";
my $password = "password1";
my $url = 'http://pages_need_authentication';
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request (GET => $url);
$req->authorization_basic ($user, $password);
my $request = $ua->request ($req);
my $page = $request->content;
# I generate a new header here, because I don't know how to grab the
header from request.
print "Content-type: text/plain\n\n";
print $page;
Crazy Monkey