From: cerr on
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
From: John Bokma on
cerr <ron.eggler(a)gmail.com> writes:

> 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',

^^^ AFAIK this must be a domain not a URL (try remove
https:// and try again)

> 'Configuration Software',
> 'admin' => 'admin'
> );

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: cerr on
On Feb 18, 12:30 pm, John Bokma <j...(a)castleamber.com> wrote:
> cerr <ron.egg...(a)gmail.com> writes:
> > 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',
>
>       ^^^ AFAIK this must be a domain not a URL (try remove
>       https:// and try again)

almost, setting it to '192.168.167.166:443' let me in! Sweet!
Thanks!
>
> >     'Configuration Software',
> >     'admin' => 'admin'
> >     );
--
roN