Simple Website Online Script
I use this script quite a bit to establish if services are working correctly or not. For example I've used it to display the online status of Minecraft servers. (http://m.wonderproject.net)
<?php
//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('http://google.com/',80); //usage
?>
can be included:
<?php
include('sitecheck.php');
return siteCheck('google.com', 80);
?>
Written by Zach Queal
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#