Good morning everyone... this hopefully is a quick question...
Basically, I'm trying to build an "audible ping" script... that will play a sound when a sucessful response comes back from a ping...
I was thinking the only way to pull this off was javascript, but then the question remains, how to actually call the sound?
So far, the code I was playing with that doesn't work...
// code in body to play the sound
echo "
<script language=\"JavaScript\"><!--
function playSound() {
document.firstSound.play();
}
//--></script>
<embed src=\"ping.wav\" hidden=true autostart=false loop=false name=\"firstSound\" mastersound>
";
if ($host) {
exec("ping $host", $output, $error);
while (list(,$line) = each($output)){
if(strstr($line,"bytes from")) {
echo "<script>window.location=\"javascript:playSound();\"</script>$line<br>";
} else {
echo "$line<br>";
}
}
}
Any ideas?
Thanks!!