I'm trying to search the array $outcome for the string "Destination host unreachable" and it doesn't work.
I'm not sure what I'm doing wrong and was wondering if someone could lend a hand?
$ip = 192.168.1.30
$pingresult = exec("ping -n 1 $ip", $outcome, $status);
if ($status == 0)
{
if(in_array("Destination host unreachable", $outcome))
{
echo "Unreachable";
}
else
{
echo "Alive";
}
}
P.S. Please note I'm on a Windows machine so the exit status is different to Linux etc.