So you can ping IP's external to your local network but you can't ping local network addresses?
Sounds like a routing problem.
Verify if IP works or not - Intranet
Moderator: General Moderators
I'm trying a different approach now.
when I echo out the exec command, I rather get this:
There are two devices that we know are offline, but it still displays it as online.
We echoed out a local/internal IP that we know works only inside this building, and it works.
Code: Select all
$ip = $row_records['IP'];
if($ip == "Not Available"){
echo 'Offline';
}else{
$status = exec("ping -n 1 $ip", $output);
$arr = explode(", ", $status);
if($arr[1] == "Received = 0"){
echo "Offline";
}else{
echo "Online";
}
}orMinimum = 0ms, Maximum = 0ms, Average = 0ms
So I did an array. If it "Recieved" nothing, it's Offline. However, it STILL displays 'Online'. My head is hurting. ~.~Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
There are two devices that we know are offline, but it still displays it as online.
We echoed out a local/internal IP that we know works only inside this building, and it works.
Code: Select all
$ip = $row_records['IP'];
if($ip == "Not Available"){
echo 'Offline';
}else{
$status = exec("ping -n 1 $ip", $output);
if(strpos($status, "100% loss") === false)
echo "Online";
else
echo "Offline";
}- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
That was because you were making Received = 0 and it could well receive 1. Am I right?So I did an array. If it "Recieved" nothing, it's Offline. However, it STILL displays 'Online'. My head is hurting
Oh and you might want to call flush() after each ping so that the web server doesn't buffer the results up for ages.