I would suggest that you use this instead:
$file = "http://www.yourdomain.com/index.htm";
$fp = @file($file);
echo "server up!";
echo "server down!";
Change the $file to be a file that is on your server. Then it will tell you if the server that the file is on is up or down. Cijori's method would be fine, but it won't work on all servers...