Hi, me and my friend just cannot get the stats working, can anyone help?
the server is fine its just the script.
+rep to helpers
Edited by Aflux (Forum Moderator) - Moved to 'Online Radios'. Please post in the correction section.

Hi, me and my friend just cannot get the stats working, can anyone help?
the server is fine its just the script.
+rep to helpers
Edited by Aflux (Forum Moderator) - Moved to 'Online Radios'. Please post in the correction section.
Last edited by Aflux; 20-01-2008 at 04:53 PM.
What would life be, without music?
Post the error an we might be able to help?
i dont know the error lmao. i just need stats that work x]
What would life be, without music?
I made that for my DJ Panel a while ago.HTML Code:<? // ** CONFIGURATION ** - Please enter details within the speech marks //Radio IP $scip = "RADIOIP"; //Radio port $scport = "RADIOPORT"; //Radio password $scpass = "RADIOPASSWORD"; //If offline, say: $offlinemsg = "Sorry! The radio is currently offline!"; // ** END CONFIGURATION ** $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); if(!$scfp) { $scsuccs=1; echo $offlinemsg; } if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $page .= fgets($scfp, 1000); } //define xml elements $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "BITRATE"); $y=0; while($loop[$y]!=''){ $pageed = ereg_replace(".*<$loop[$y]>", "", $page); $scphp = strtolower($loop[$y]); $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE) $$scphp = urldecode($$scphp); $y++; } //end intro xml elements //get song info and history $pageed = ereg_replace(".*<SONGHISTORY>", "", $page); $pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed); $songatime = explode("<SONG>", $pageed); $r=1; while($songatime[$r]!=""){ $t=$r-1; $playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]); $playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]); $song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]); $song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]); $song[$t] = urldecode($song[$t]); $dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page); $dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed); $r++; } //end song info fclose($scfp); } //display stats if($streamstatus == "1"){ //you may edit the html below, make sure to keep variable intact echo " <p align=center><center> <b>DJ:</b> $servertitle<br> <b>Listeners:</b> $currentlisteners / $maxlisteners<br> <b>Current Song:</b> $song[0]</p> <p><b>Song History</b></p> <p><b>1.</b> $song[1]<br> <b>2.</b> $song[2]<br> <b>3.</b> $song[3]<br> <b>4.</b> $song[4]<br></p> "; } //If radio is offline. if($streamstatus == "0") { echo "<p>$offlinemsg</p>"; } ?>
I hope it worksYou only need to change the top bit where it says RADIOIP etc.
2005: JOINED ; Radio DJ
2006: Radio DJ ; Senior DJ
2007: HxTV Flash Artist ; Productions Staff ; HxHD Staff ; Head DJ ; Events Organiser ; Productions Staff ; Competitions Staff ; Assistant Radio Manager
2008: Senior Competitions Staff ; Forum Moderator ; HxHD Staff ; Competitions Manager ; Graphics Designer
2009: LEFT ; Guest DJ
You also need to change most of the varibles, such as the login infomation and the port.I made that for my DJ Panel a while ago.HTML Code:<? // ** CONFIGURATION ** - Please enter details within the speech marks //Radio IP $scip = "RADIOIP"; //Radio port $scport = "RADIOPORT"; //Radio password $scpass = "RADIOPASSWORD"; //If offline, say: $offlinemsg = "Sorry! The radio is currently offline!"; // ** END CONFIGURATION ** $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); if(!$scfp) { $scsuccs=1; echo $offlinemsg; } if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $page .= fgets($scfp, 1000); } //define xml elements $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "BITRATE"); $y=0; while($loop[$y]!=''){ $pageed = ereg_replace(".*<$loop[$y]>", "", $page); $scphp = strtolower($loop[$y]); $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE) $$scphp = urldecode($$scphp); $y++; } //end intro xml elements //get song info and history $pageed = ereg_replace(".*<SONGHISTORY>", "", $page); $pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed); $songatime = explode("<SONG>", $pageed); $r=1; while($songatime[$r]!=""){ $t=$r-1; $playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]); $playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]); $song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]); $song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]); $song[$t] = urldecode($song[$t]); $dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page); $dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed); $r++; } //end song info fclose($scfp); } //display stats if($streamstatus == "1"){ //you may edit the html below, make sure to keep variable intact echo " <p align=center><center> <b>DJ:</b> $servertitle<br> <b>Listeners:</b> $currentlisteners / $maxlisteners<br> <b>Current Song:</b> $song[0]</p> <p><b>Song History</b></p> <p><b>1.</b> $song[1]<br> <b>2.</b> $song[2]<br> <b>3.</b> $song[3]<br> <b>4.</b> $song[4]<br></p> "; } //If radio is offline. if($streamstatus == "0") { echo "<p>$offlinemsg</p>"; } ?>
I hope it worksYou only need to change the top bit where it says RADIOIP etc.
Want to hide these adverts? Register an account for free!