> Uncomment(take away the forward slashes //) // all the echo statements to get a full list of all the variables, // if you dont know what im talking about, then stop right here and go learn php // http://www.php.net // http://www.thickbook.com << very resourcefull for beginners /////////////////////////////////////////////////////////////////////////////////////////////// include ("config.php"); $listenlink = 'http://'.$host.':'.$port.'/listen.pls'; //make link to stream $fp = fsockopen("$host", $port, &$errno, &$errstr, 30); //open connection if(!$fp) { $success=2; //set if no connection } if($success!=2){ //if connection fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html while(!feof($fp)) { $page .= fgets($fp, 1000); } fclose($fp); //close connection $page = ereg_replace(".*", "", $page); //extract data $page = ereg_replace(".*", ",", $page); //extract data $numbers = explode(",",$page); //extract data $currentlisteners=$numbers[0]; //set variable $connected=$numbers[1]; //set variable if($connected==1) //if DSP is connected $wordconnected="yes"; //set variable else //if no DSP connection $wordconnected="no"; //set variable $peaklisteners=$numbers[2]; //set variable $maxlisteners=$numbers[3]; //set variable $reportedlisteners=$numbers[4]; //set variable ##Stuff printing out to screen may want to shut off.## // echo('$listenlink = '.$listenlink.'
'); // echo('$reportedlisteners = '.$reportedlisteners.'
'); // echo('$maxlisteners = '.$maxlisteners.'
'); // echo('$peaklisteners = '.$peaklisteners.'
'); // echo('$connected = '.$connected.'
'); // echo('$wordconnection = '.$wordconnected.'
'); // echo('$currentlisteners = '.$currentlisteners.'
'); ##Okay stop commenting stuff out now.## } if($connected==1){ //only do if DSP is connected $fp = fsockopen("$host", $port, &$errno, &$errstr, 30); //open connection if(!$fp) { //if no connection $success1=2; //dummy variable to see if successful connect } if($success1!=2){ //only do if connected fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get index.html while(!feof($fp)) { $page .= fgets($fp, 1000); } $pageed = ereg_replace(".*Stream is up at ", "", $page); //extract data $bitrate = ereg_replace(" kbps.*", "", $pageed); //extract data fclose($fp); //close connection ##Print out bitrate.## //echo('$bitrate = '.$bitrate.'
'); ##You know the drill stop here.## } } $fp = fsockopen("$host", $port, &$errno, &$errstr, 30); //open connection yet again if(!$fp) { //if connection $success2=2; } if($success2!=2){ //if connected fputs($fp,"GET /admin.cgi?pass=$password&mode=viewxml HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get XML page while(!feof($fp)) { $page .= fgets($fp, 1000); } $loop = array("AVERAGETIME", "SERVERGENRE", "SERVERURL", "SERVERTITLE", "SONGTITLE", "SONGURL", "IRC", "ICQ", "AIM", "WEBHITS", "STREAMHITS", "INDEX", "LISTEN", "PALM7", "LOGIN", "LOGINFAIL", "PLAYED", "COOKIE", "ADMIN", "UPDINFO", "KICKSRC", "KICKDST", "UNBANDST", "BANDST", "VIEWBAN", "UNRIPDST", "VIEWRIP", "VIEWXML", "VIEWLOG", "INVALID"); //define all the variables to get (delte any ones you don't want) $y=0; //dummy variable for while loop while($loop[$y]!=''){ //while there are things in loop $pageed = ereg_replace(".*<$loop[$y]>", "", $page); // extract data $phpname = strtolower($loop[$y]); //make names in loop lowercase for variable names $$phpname = ereg_replace(".*", "", $pageed); //finish extracting data if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE) //if for code clean-up (if you have problems with variables with URL encoding (i.e. %20 for space put them in this loop) $$phpname = urldecode($$phpname); // replace URL code with regular text (i.e. %20 = space) ##More stuff that prints## //echo ('$'.$phpname.' = '.$$phpname.'
'); ##Stop here. Your server will be upset if you comment out the next line of code ($y++;).## $y++; //update dummy variable for while loop } $pageed = ereg_replace(".*", "", $page); //extract data $pageed = ereg_replace(".*", "", $pageed); //extract data $songatime = explode("", $pageed); //break data down for each song $r=1; //dummy variable while($songatime[$r]!=""){ //while loop for each song $t=$r-1; //correction for first value in array from explode is worthless $playedat[$t] = ereg_replace(".*", "", $songatime[$r]); // extract data $playedat[$t] = ereg_replace(".*", "", $playedat[$t]); //extract data $song[$t] = ereg_replace(".*", "", $songatime[$r]); //extract data $song[$t] = ereg_replace(".*", "", $song[$t]); //extract data $song[$t] = urldecode($song[$t]); //cleans-up the URL code thing again ##Yet even more crap that gets printed out.## //echo ('$song['.$t.'] = '.$song[$t].'
$playedat['.$t.'] = '.$playedat[$t].'
'); ##Same as last time. Unhappy servers tend to hurt people.## $r++; //update loop variable } $pageed = ereg_replace(".*", "", $page); //extract data $pageed = ereg_replace(".*", "", $pageed); //extract data $listeninfo = explode("", $pageed); //break apart data $r=1; //dummy loop variable while($listeninfo[$r]!=""){ //while loop for extraction $t=$r-1; //correction for first value in array from explode is worthless $hostname[$t] = ereg_replace(".*", "", $listeninfo[$r]); //extract data $hostname[$t] = ereg_replace(".*", "", $hostname[$t]); //extract data $useragent[$t] = ereg_replace(".*", "", $listeninfo[$r]); //extract data $useragent[$t] = ereg_replace(".*", "", $useragent[$t]); //extract data $underruns[$t] = ereg_replace(".*", "", $listeninfo[$r]); //extract data $underruns[$t] = ereg_replace(".*", "", $underruns[$t]); //extract data $connecttime[$t] = ereg_replace(".*", "", $listeninfo[$r]); //extract data $connecttime[$t] = ereg_replace(".*", "", $connecttime[$t]); //extract data ##Yet even more crap that gets printed out.## // echo ('$hostname['.$t.'] = '.$hostname[$t].'
$useragent['.$t.'] = '.$useragent[$t].'
$underruns['.$t.'] = '.$underruns[$t].'
$connecttime['.$t.'] = '.$connecttime[$t].'
'); ##STOP. Just think that was the last set of echos you have to comment out.## $r++; //update loop variable } fclose($fp); //close connection } $password=changeme //Leave this. It writes over real value so if someone were to use //include to get this page they cannot use echo $password to get your //password. There is probably a better way to do this but I can't code. ?>
Shit! Looks like something is broke up in this mothafucka! (try refreshing your browser)