Powermaster
Site Supporter
I am tring to compose this script to tell when a server is up or down.
Works just fine but, when pluging in a port in the is closed I get a nasty output.
See http://www.powermaster.cc/test.php
Thanks for your suggestions!
PHP:
<?
$fp = fsockopen('apple.com', '80', $errno, $errstr, 2);
if(!$fp) {
echo '<font color="#FF0000" face="Arial, Helvetica, sans-serif">Down</font>';
} else {
socket_set_timeout($fp, 0,1);
echo '<font color="#00FF00" face="Arial, Helvetica, sans-serif">UP</font>';
}
?>
Works just fine but, when pluging in a port in the is closed I get a nasty output.
See http://www.powermaster.cc/test.php
Thanks for your suggestions!