v-dev-redis01:/root# cat a1.pl
sub check_web{
use LWP::UserAgent;
$web = shift;
my $ua = LWP::UserAgent->new;
$ua->timeout(5);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
my $response = $ua->get("$web");
if ($response->is_success) {
# print $response->decoded_content; # or whatever
return 1;
}
else {return 0;
} };
$var=&check_web("$ARGV[0]");
print "$var
";
v-dev-redis01:/root# perl a1.pl https://www.zjtest2.com
1
v-dev-redis01:/root# perl a1.pl https://www.zjtest100.com
0