Hello again.
I was trying to login to my web server protected with basic auth, and after i understood that it would be nice to automatically detect the realm so now i want to know on how to do so.
Thanks in advance.

Sorry if i didnt expleined me well.
I have the next code :

use LWP::UserAgent;
my $browser = LWP::UserAgent->new;
$browser->agent('localbot');
$browser->credentials(
'127.0.0.1:80',
'testing',#<- the $realm
'admin' => 'password');

my $response = $browser->get('http://127.0.0.1/');
if($response->status_line eq '200 OK')
{
print $response->decoded_content;
}

And i want that the $realm be detected automatically.

Ok, found the solution, i can get it with:
print $response->header("WWW-Authenticate");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.