July 28, 2010 | In: Website Scripts
Q&A: Looking for a “Ping IP Script” to post on my website.?
Question by lazywolfy: Looking for a “Ping IP Script” to post on my website.?
I am creating a survey for my forum which shows users a list of multiple IP addresses and asks them to select the IP that offers the best ping from their location. (its for a gameserver).
Instead of me having to post the instructions on how to manually ping an IP, I’d like to find a script that I can post on my website that automatically shows a visitor what their ping is to the various IP’s (gameservers). In order to do this, the script would need to be able to identify the users IP address first, then it would need to ping the IP’s specified, then display the results automatically.
Is this possible?
Where could I find such a script?
Or where could I ask for more advice? Website?
I’ve seen similar scripts in signatures that people use on forums:
“You’re IP is xx.xx.xx.xx”
Thanks
Best answer:
Answer by digitallysmooth
You will be asking your users to download and/or install a script or application. This is different from the “Your IP is xx.xx.xx.xx” scripts you see on the net. The reason you can get a visitor’s IP address is because your web server is recording the IP address when the visitor make a request to your site.
Pinging an address from the visitor’s own connection is a different story. First write the script or exe and test it. Once you have that done, post another question which asks how to easily instruct a visitor to download and run your application.
There may be some nifty ways to do this with a java applet or an activeX application. Both of these methods are quite deprecated so you should research alternative methods. I’m not 100% but you may have some luck in looking into Adobe AIR + some strategic java-scripting. Again, not sure but worth a look.
Know better? Leave your own answer in the comments!

1 Response to Q&A: Looking for a “Ping IP Script” to post on my website.?
sixtiesradical
July 28th, 2010 at 4:19 am
Not sure how good an idea this is, or whether your hosting service will approve, but from PHP:
< ?php
if (isset($_REQUEST['ping_ip'])) {
$p = popen('ping '.$_REQUEST['ping_ip'], 'r');
while($p && !feof($p)) {
echo fgets($p).'
‘;
}
pclose($p);
}
// etc.
?>