basic authorization code failing
Bhatia, Sanjay (bhatias@segasoft.com)
Fri, 20 Jun 1997 16:03:54 -0700
hi,
i have a small program, which is supposed to traverse a list of URLs. =
in the first URL, it has to do some basic authorization to get to the =
rest. problem is that i get a 401 - Unauthorized error from the onset.
can someone please tell me where things are going wrong?
thanks.
sb
the code is.....
$h =3D new HTTP::Headers ;
$h->authorization_basic($name, $passwd) ;
my $request =3D new HTTP::Request "$method", =
"http://althea.heat.net/ $script", $h;
print "got method as $method and script as.. $script\n" ;
$ua =3D new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent );
my $res =3D $ua->request($request);
if ($res->is_success)
{
print length($res->content), "\n";
}
else
{
# print "Bad luck this time\n";
print $res->error_as_HTML ;
}