I'm working on a small php script and i'd like to add ping feature to the script. I really don't know how to do it but , i like to have the same result as this : http://www.ipfingerprints.com/ping.php
Asked
Active
Viewed 4,829 times
4 Answers
0
Depending on the permissions in php, you might be able to
<?php system("ping -c 3 localhost"); ?>
Be very careful accepting hostnames from web forms - if a user requests that you ping the server "; rm -rf /", you will lose all your data!

AMADANON Inc.
- 5,753
- 21
- 31
-
But i want to get the result as table as ipfingerprints – Yassin Sterno Jun 23 '13 at 22:57
0
it is very simple
<?php
if (!$socket = @fsockopen("YOUR.IP.HERE", 80, $errno, $errstr, 30))
{
echo "<font color='red'><strong>Offline!</strong></font>";
}
else
{
echo "<font color='green'><strong>Online!/strong></font>";
fclose($socket);
}
?>

MineScript
- 291
- 1
- 4
-
I want to get the result not to see if website is online or offline – Yassin Sterno Jun 23 '13 at 22:59
0
If you want to have real ping (send ICMP packets) you can take a look at this Native-PHP ICMP ping implementation, but I didn't test it.

jcubic
- 61,973
- 54
- 229
- 402