Merge branch 'ent-12774-16934-modificacion-de-plugin-web_check_lwp' into 'develop'

upload web_check_lwp.pl

See merge request artica/pandorafms!6928
This commit is contained in:
Matias Didier 2024-02-21 10:14:08 +00:00
commit 1de584898e
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
use strict;
use warnings;
use LWP::UserAgent ();
use Data::Dumper;
die "Usage: $0 <URL> <username> <password>\n" unless @ARGV == 3;
my ($URL, $username, $password) = @ARGV;
my $ua = LWP::UserAgent->new(timeout => 10);
$ua->protocols_allowed( ['http', 'https'] );
$ua->ssl_opts("verify_hostname" => 0);
$ua->credentials($URL, "", $username, $password);
my $response = $ua->get($URL);
if ($response->is_success) {
print $response->decoded_content;
}
else {
die print(Dumper($response));
}