View Full Version : Script to ping my IP
Kamui
Sat 8th Jun '02, 6:56am
Does such a thing exist? I've been looking for a bit... Basically, I just want it to ping my IP, because I run a game server. I just want it to report something like "Server is up" or "Server is down" and ping every 1-5 minutes or so. If I could somehow put it on the vbulletin forumhome it would be even better. I tried writing one but it didn't work (grrrr)
nuno
Sat 8th Jun '02, 7:51am
http://www.hotscripts.com/PHP/Scripts_and_Programs/Networking_Tools/Ping/
Kamui
Sat 8th Jun '02, 7:35pm
I tried those, but those all require you to enter your IP into a page. I need to be able to automatically ping when a user browses the site (or ping at fixed times and display the results)
For an example, go to http://ro.pak0.com and look on the right hand side. The green names means the server is up, red means it is down.
The linkstatus one is about right, since it does check automatically. But it checks http, and unless I put a httpd of some kind on my comp, it won't work. Actually, that's not a bad idea...
And, after a bit of modifying the script, it now shows it correctly. Thanks.
nuno
Sat 8th Jun '02, 7:44pm
there you go, edit it to match your needs, upload it to your server, save as type .php and launch it :)
<?php
error_reporting (E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit (0);
$telnetclient = "zeth";
$remotehost[0] = "abandonedrealms.net";
$remoteport[0] = "9000";
$remotehost[1] = "cnn.com";
$remoteport[1] = "80";
$remotehost[2] = "freebsd.org";
$remoteport[2] = "80";
$c = count($remotehost);
$c2 = count($remoteport);
if($c != $c2){
die("You must have both remoteport and remotehost specified for all servers.");
}
?>
<html>
<head>
<title>Server status checker</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000">
<tr>
<td>
<table width="291" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#00CCFF">
<td><b><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2">Server
name</font></b></td>
<td><b><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2">Status</font></b></td>
</tr>
<?php
for ($i = 0; $i < $c; $i++) {
$fp = fsockopen("$remotehost[$i]", $remoteport[$i], $errno, $errstr);
if (!$fp) {
?>
<tr bgcolor="#FFFFFF">
<td><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><?php echo $remotehost[$i].":".$remoteport[$i]; ?></font></td>
<td>
<div align="center"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1">DOWN</font></div>
</td>
</tr>
<?php
} else {
?>
<tr bgcolor="#FFFFFF">
<td><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><?php echo $remotehost[$i].":".$remoteport[$i]; ?></font></td>
<td>
<div align="center"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1">UP</font></div>
</td>
</tr>
<?php
fclose ($fp);
}
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
Kamui
Sat 8th Jun '02, 11:11pm
Wow, that's even better! Now I don't have to run that httpd. Is there any way to integrate this into displaying on vBulletin? I tried but I keep getting parse errors on my test board.
vBulletin® v3.8.0 Beta 4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.