Website / Server Monitoring Script in PHP

Are you looking for php script that help you to monitor your server or website? I’ve written one simple script in php that can help you to monitor your website status.

<%
$servers = array("saqib-ansari.com", "google.com", "yahoo.com", "8.8.8.8");

$port = '80';

foreach ( $servers as $host )
{
	$status = fsockopen( $host, $port, $errno, $errstr, 6 );
	echo "Host $host is ";
	if ( !$check )
		echo "DOWN! <br />\n";
	else
		echo "UP! <br />\n";
}
%>

You can enhance this script as per your requirement.

Happy Server Monitor

More Free Webmaster Scripts

  • samiullah

    The code says Host is Down! but the hosts are running…Can you provide the proper code…