Codice PHP:
$timeout = 3; // in secondi
$sites = array();
$sites[] = 'cnn.com:80';
$sites[] = 'bluesnews.com:80';
$sites[] = 'shacknews.com:80';
$sites[] = 'hardocp.com:80';
$sites[] = 'ghfghfghfg.com:80';
foreach($sites as $site) {
$server = explode(":",$site);
$sock = @fsockopen( $server[0], $server[1], $errno, $errstr, $timeout );
if ( ! $sock ) {
echo "Il server ".$site." è [b]<font color=\"FF0000\">offline[/b]</font>
";
} else {
echo "Il server ".$site." è [b]<font color=\"00FF00\">online[/b]</font>
";
}
}