Lee Findlow

Server Status

Server Status Script

This is a simple PHP Class which allows for you to check the status(es) of different services on your server. It simply checks that there is a response from the port which a specific service is running on, for example port 80 for a standard web server, and returns weather or not a connection could be established. Please note that this does not guarantee 100% accuracy, as a server may be responding but not actually be working.

Key Features

  • Simple Operation: Just a few lines of code are required to implement this code in it’s simplest form, but it can easily be expanded to perform more advanced functions.

Download

You can download this script free of charge, although I would appreciate a link back to http://leefindlow.com. There is just one file required to operate, please click on the link below then save the code as a “.php” file then upload it to your server to use.

Example Usage

Here are some examples of what this script can do.

Basic Usage – Check for Internet Connectivity

<?php
include('./PathToDownloadedScript.php');
$Status = new ServerStatus;
if($Status->CheckStatus('google.com')){ echo 'Connected'; } else{ echo 'Not Connected'; }
?>

This code will output Connected or Not Connected depending on weather an internet connection could be detected.