Check a Port

By F*U*R*B*Y* on Nov 17, 2006

ok this is great to show your users what Services you have online. i'm currently using it for it to check my Website, my IRC Server and my Eggdrop. this is great, you just upload it, change the IP or anything else and its set to go

i've set it up for just IRC Server and Website. so its pretty good

and the two images are located here. http://www.hawkee.com/profile/img/190/ ---- thats on.gif
http://www.hawkee.com/profile/img/191/ ---- thats off.gif

<?php

  $server  = "127.0.0.1";
  $port   = "80";
  $port2   = "6667";
  $timeout = "10";

  if ($server and $port and $timeout) {
    $verbinding =  @fsockopen("$server", $port, $errno, $errstr, $timeout);
    $ircbinding =  @fsockopen("$server", $port2, $errno, $errstr, $timeout);
  }
  if($verbinding) {
    echo "<img src='./images/on.gif'>Website is online<br>";
  }
  else {
    echo "<img src='./images/off.gif'>Website is offline<br>";
  }
  if($ircbinding) {
    echo "<img src='./images/on.gif'>IRC Server is online<br>";
  }
  else {
    echo "<img src='./images/off.gif'>IRC Server is offline<br>";
  }
?>

Comments

Sign in to comment.
Yiorgos   -  Jan 26, 2012

This is very good and works like a charm. I am currently using it to monitor all my other services apart from the webpage :) thanks a bunch you saved me an hour today :)

 Respond  
Sargo Darya   -  Jun 17, 2010

Well, using it now to check if our game servers are up. Works like a charm dude.

Btw.: It's not a good idea to let this run everytime. Should be cached so it runs only every 5-10 minutes. Otherwise it will occupy your servers socket connections.

 Respond  
KuTsuM   -  Nov 19, 2006

\"Yoinx, if you have it on your Domain and thats not hosted off of your computer then no it won\'t show it online.\"

127.0.0.1 is localhost no matter what system a server is hosted on and who is connecting to it..

 Respond  
F*U*R*B*Y*   -  Nov 19, 2006

any scores? :p

 Respond  
F*U*R*B*Y*   -  Nov 17, 2006

ok, i\'ve sort of done a bit of remodeling and i like how i have it, i\'ve gotten 2 pictures and i\'ll upload them to here for you guys if you want them. i\'ll edit the code to include them

 Respond  
Yoinx   -  Nov 17, 2006

If your website is down, wouldnt that sorta make that page not work to begin with?

 Respond  
Noutrious   -  Nov 17, 2006

Again, nice :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.