Skip to content

Instantly share code, notes, and snippets.

@zQueal
Created May 9, 2012 15:18
Show Gist options
  • Select an option

  • Save zQueal/2645404 to your computer and use it in GitHub Desktop.

Select an option

Save zQueal/2645404 to your computer and use it in GitHub Desktop.
PHP Website Online Script
<?php
// (C) 2012 Zach Queal - Usage: $status = ServerStatus('domain.com',80);
// Icons (C) 2012 @designkindle http://www.designkindle.com/
function siteCheck($site, $port){
$check = @fsockopen($site, $port, $errno, $errstr, 30);
if($check){
echo "<img alt='Online!' src='http://i.imgur.com.nyud.net/QXgTw.png' />";
} else {
echo "<img alt='Offline!' src='http://i.imgur.com.nyud.net/9PHoh.png' />";
}
}
return siteCheck('google.com',80);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment