Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials
( categories: )

To verify the status of a web site, use the head function from LWP::Simple module.

In scalar context, head returns true if the url passed as a parameter is accessible.

Example:

#!/usr/bin/perl
 
use LWP::Simple;
 
if ( head("http://www.perlhowto.com") )
{
  print "perlhowto.com is running!\n";
}
else
{
  print "Oops! site is down\n";
}