mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
upload web_check_lwp.pl
This commit is contained in:
parent
b4c8e81e86
commit
a860338f31
24
pandora_plugins/web_check/web_check_lwp.pl
Normal file
24
pandora_plugins/web_check/web_check_lwp.pl
Normal 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));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user