<?php
/* Shoutcast MP3 Server Status script
by Todd Eddy
php@vrillusions.com
www.vrillusions.com

Feel free to edit, manipulate, construde, consume, regurgitate,
exfoliate, contemplate, and manage this any way that you wish. */

/* Although I made this to check the status of an mp3 station, it 
   can very easily be ported to check the status of any website, 
   or an ftp server */

/* BEGIN STANDALONE VERSION
Syntax:
checkmp3svr.php3?url=http://IPofSvr:Port/&svr=subnameOfPLSFile

the svr variable is used for the playlist file, if you were to 
just use this straight "out-of-the-box" would link to listen-$svr.pls.
You need to create each of these .pls files manually, or make a 
script to do it, if you wish. */

if ($url) {
   $fp = @fopen($url,"r");
   if ($fp) { echo "<a href=\"listen-$svr.pls\">$url</a>"; }
   else { echo "<font color=\"#FF0000\"><b>Offline</b></font>"; }
}
else { echo "You forgot to enter the URL"; }

// END STANDALONE VERSION



/* BEGIN SUBFUNCTION VERSION
Syntax:
checkMP3svr("http://IPofSvr:Port/","subnameOfPLSFile");

See description above for explanation of the subnameOfPLSFile part

NOTE: NO ERROR CHECKING IS DONE, MAKE SURE YOU SPECIFY URL OR IT 
WILL AUTOMATICALLY THINK ITS OFFLINE */

function checkMP3svr ($url,$svr) {
   global $fontcolor_data_link;
   $fp = @fopen($url,"r");
   if ($fp) { echo "<a href=\"listen-$svr.pls\">$url</a>"; }
   else { echo "<font color=\"#FF0000\"><b>Offline</b></font>"; }
}

// END SUBFUNCTION VERSION
?>