Hi, thanks for the tip. I tried the following but when I ping a live address that returns the string "0% packet loss" in $status the elseif does not catch it. Anyone know what is wrong with my code? Thanks!
<?php
$domain = "yahoo.com";
$status = exec("/bin/ping -c 2 -w 10 -q $domain");
if (ereg("100% packet loss",$status)) {
$out = "Dead";
}
elseif (ereg("0% packet loss",$status)) {
$out = "Alive";
}
elseif (ereg("errors",$status)) {
$out = "Errors";
}
else {
$out = "Unknown";
}
echo "$out";
?>