Well, I've Googled how to do this a bit and found no efficient way to do it. What I would like is something that pings a computer on the local network using a predefined address/name etc., and if it can be reached, return "foobar". It'll be running on a Windows-based fileserver, on a page that shows shared folders and computers on the network.
Thanks
EDIT: I figured out what was wrong with the ping command I already had:
php code:
function pingcomputer($name){
exec('ping -n 1 '.$name.' 2>&1',$output,$result); // was -c 1 instead of -n 1 which is what windows uses
if($result==0){
return '<img src="online.png" title="Online" alt=""/>';
}else{
return '<img src="offline.png" title="Offline" alt=""/>';
}
}