<?php
$ip1 = "192.168.0.2";
$ip2 = "192.168.0.3";
$ip3 = "192.168.0.11";
$ping1 =`ping -n 1 $ip1`;
$ping2 =`ping -n 1 $ip2`;
$ping3 =`ping -n 1 $ip3`;
echo "<br><hr><br>";
echo "Computer 1a<br>";
echo "<pre>".$ping1."</pre>";
echo "<br><hr>Computer 2a<br>";
echo "<pre>".$ping2."</pre>";
echo "<br><hr>Computer L1a<br>";
echo "<pre>".$ping3."</pre>";
?>
it results in this:
[QUOTE]
Computer 1a
Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: bytes=32 time<10ms TTL=128
Ping statistics for 192.168.0.2:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Computer 2a
Pinging 192.168.0.3 with 32 bytes of data:
Request timed out.
Ping statistics for 192.168.0.3:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Computer L1a
Pinging 192.168.0.11 with 32 bytes of data:
Reply from 192.168.0.11: bytes=32 time<10ms TTL=128
Ping statistics for 192.168.0.11:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
[/QUOTE]
im running it on a windows server, im not sure what it does on linux based ones.....
anyway, several questions.
1.) If i post the results on a website is that a save thing? or is there a way to access the cmd through this? (dumb question probably?) 😃
2.) How do i make it so that if the ping times out it shows OFFLINE and when its a positive reply it shows ONLINE, i guess i need to extract the result somehow? i thought 'explod' but cant really figure out how?
Thanks your time... 😃