Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Checking Server Status with PHP Jump to:  
Category: >> PHP Code >> Checking Server Status with PHP Bookmark and Share

<< lastnext >>

Snippet Name: Checking Server Status with PHP

Description: A small bit of code to check server status and report the results. Easily combined with an emailer to send a text message to a phone for real-time alerting of server issues.

Also see:
» Count the number of checked checkboxes...
» Fix missing $_SERVER SCRIPT_URL variab...
» Checking Server Status with PHP
» Check for duplicates and delete duplic...
» MKDIR with error checking
» Check Constraint - Create
» Check email address
» INSERT WITH CHECK OPTION
» Yahoo Online Status
» Check number of characters in a range
» Check if an image exists (GD)
» Check if a file exists
» Toggle All Checkboxes on or off
» Check if array is associative
» Check syntax of multiple PHP files all...
» Deferring Constraint Checking
» Count checkboxes
» Check or Uncheck all Checkboxes
» Check radio button selection
» Constraint Checks
» Check If Domain Exists

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?PHP
 
// Domain name to check
$domainName = "http://www.psoug.org" ;
 
FUNCTION DomainCheck($domain_name){
    $start_time = MICROTIME(TRUE);
    $openDomain = FSOCKOPEN ($domain_name, 80, $errno, $errstr, 10);
    $end_time  = MICROTIME(TRUE);
    $server_status    = 0;
 
    IF (!$openDomain){
		$server_status = -1;  
    }ELSE{
        FCLOSE($openDomain);
        $status = ($end_time - $start_time) * 1000;
        $server_status = FLOOR($server_status);
    }
    RETURN $server_status;
}
 
$server_status = DomainCheck($domain_name);
 
 
IF ($server_status != -1) {
	PRINT "Cannot reach the server." ;
}ELSE{
	PRINT "Server is responding properly." ;
} 
 
?>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 65 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?