libwww-perl authorization problem

Hi There,

I'm trying to login to a ssl encrypted webinterface with authrization
uing LWP but I don't get authorized for some reason and i can't figure
out why not.
My code:
my $url = 'https://192.168.167.166/'; # Yes, HTTPS!
my $browser = LWP::UserAgent->new;
$browser->credentials(
'https://192.168.167.166',
'Configuration Software',
'admin' => 'admin'
);
my $response = $browser->get($url);
print $response->header('WWW-Authenticate')."\n";
die "Error at $url\n ", $response->status_line, "\n Aborting"
unless $response->is_success;
print "Whee, it worked! I got that ",
$response->content_type, " document!\n";
and i keep getting following in my console:
Basic realm="Configuration Software"
Error at https://192.168.167.166/
401 Authorization Required
Aborting at ./login.pl line 40.
What's the problem? I can log-in just fine using a browser...
Thanks,
roN


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
cerr [ Do, 18 Februar 2010 20:32 ] [ ID #2032860 ]

Re: libwww-perl authorization problem

On Thu, 18 Feb 2010 11:32:01 -0800, cerr wrote:
> I'm trying to login to a ssl encrypted webinterface with authrization
> uing LWP but I don't get authorized for some reason and i can't figure
> out why not.
> My code:
> my $url = 'https://192.168.167.166/'; # Yes, HTTPS! my $browser =
> LWP::UserAgent->new;
> $browser->credentials(
> 'https://192.168.167.166',
> 'Configuration Software',
> 'admin' => 'admin'
> );
> my $response = $browser->get($url);
> print $response->header('WWW-Authenticate')."\n"; die "Error at $url\n
> ", $response->status_line, "\n Aborting"
> unless $response->is_success;
> print "Whee, it worked! I got that ",
> $response->content_type, " document!\n";
> and i keep getting following in my console:
> Basic realm="Configuration Software"
> Error at https://192.168.167.166/
> 401 Authorization Required
> Aborting at ./login.pl line 40.
> What's the problem? I can log-in just fine using a browser... Thanks,
> roN

Try using WWW::Mechanize and post your code if it doesn't work. It has
much more straightforward credentialling interfaces (I know; I wrote one
of them).

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Peter Scott [ So, 28 Februar 2010 19:38 ] [ ID #2033677 ]
Perl » gmane.comp.lang.perl.beginners » libwww-perl authorization problem

Vorheriges Thema: question
Nächstes Thema: Getting the text from a PDF file