Author Topic: Checking Server Status  (Read 1093 times)

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Checking Server Status
« on: October 30, 2006, 12:03:29 PM »
This is a function that can check the status of a server.
It needs fsockopen() enabled.

Code: [Select]
<?php
function server_status($server$port$timeout 5){
if (!
fsockopen ($server$port$errno$errstr$timeout)) {
$status "Offline"// If NOT successful
} else {
$status "Online"// If successful
}
return 
$status// return to $status
}
// The script:
// echo server_status(url string, port int, timeout int [optional]);
?>

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal