Results 1 to 6 of 6

Thread: Radio Stat's

  1. #1
    Join Date
    Jan 2005
    Posts
    99
    Tokens
    0

    Default Radio Stat's

    Anyone know the coding for radio stats for shoutcast???

    I tried this but it wont work Any help would be appreciated
    Code:
     
     
    <script>
     
    <!--
     
     
     
    /*
     
    Auto Refresh Page with Time script
     
    By JavaScript Kit (javascriptkit.com)
     
    Over 200+ free scripts here!
     
    */
     
     
     
    //enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
     
    var limit="0:30"
     
     
     
    if (document.images){
     
    var parselimit=limit.split(":")
     
    parselimit=parselimit[0]*60+parselimit[1]*1
     
    }
     
    function beginrefresh(){
     
    if (!document.images)
     
    return
     
    if (parselimit==1)
     
    window.location.reload()
     
    else{ 
     
    parselimit-=1
     
    curmin=Math.floor(parselimit/60)
     
    cursec=parselimit%60
     
    if (curmin!=0)
     
    curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
     
    else
     
    curtime=cursec+" seconds left until page refresh!"
     
    window.status=curtime
     
    setTimeout("beginrefresh()",1000)
     
    }
     
    }
     
     
     
    window.onload=beginrefresh
     
    //-->
     
    </script><?php
     
    // Shoutcast Server Stats
     
    // Parses shoutcasts xml to make an effective stats thing for any website
     
    // ©2004-2005 Daniel Brown http://www.gmtt.co.uk
     
    // Please refer to the readme file for use.
     
    include('config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone
     
    $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
     
    if(!$scfp) {
     
    $scsuccs=1;
     
    echo''.$scdef.' is Offline';
     
    }
     
    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);
     
    }
     
    ######################################################################################################################
     
    /////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
     
    //define xml elements
     
    $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
     
    $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);
     
     
     
    // uncomment the next line to see all variables
     
    //echo'$'.$scphp.' = '.$$scphp.'<br>';
     
    $y++;
     
    }
     
    //end intro xml elements
     
    ######################################################################################################################
     
    ######################################################################################################################
     
    /////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
     
    //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'
     
    <html>
     
    <title>'.$scdef.'</title>
     
    </head>
     
     
     
    <body text="" bgcolor="">
     
     
     
     
     
     
     
     
     
    <p align="center"><center>
     
     
     
    <font face="arial" size="2"><b>&nbsp;Tuned Into: </b>&nbsp;'.$servertitle.'</font>
     
    <font face="arial" size="2"><b>&nbsp;<br> With </b>&nbsp;'.$currentlisteners.' Listeners</font></p>
     
     
     
    <font face="arial" size="2" color=""><b>
     
     
     
    Song:</b> '.$song[0].'</font></p><
     
    <b>
     
     
     
     
     
    <p><font face="arial" size="2">
     
    Other Songs:</font></b>
     
    <font color=""><font face="arial" size="2">
     
    <p align="center">
     
    <b>1.</b> '.$song[1].'<BR>
     
    <b>2.</b> '.$song[2].'<BR>
     
    <b>3.</b> '.$song[3].'<BR>
     
    <b>4.</b> '.$song[4].'<BR>
     
    <b>5.</b> '.$song[5].'<BR>
     
    </font>
     
    <BR>
     
    </p></p>
     
    </body>
     
     
     
    </html>';
     
    }
     
    if($streamstatus == "0")
     
    {
     
    //you may edit the html below, make sure to keep variable intact
     
    echo'
     
    <html>
     
     
     
    <head>
     
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
     
    <meta name="ProgId" content="FrontPage.Editor.document">
     
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
     
    <META HTTP-EQUIV="REFRESH" CONTENT="30;URL=radio_stats1.php">
     
    <link rel=stylesheet href="" type="text/css">
     
    <title>Radio Server Is Offline</title>
     
    </head>
     
     
     
    <body text= "#000000" bgcolor="#215DDE">
     
    <center><b><font style="tahoma">No One Is Djing. <br> 
     
    </body>
     
     
     
     
     
    </html>';
     
    }
     
    ?><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
    I've put this into a code box for you as it's easier to read through .
    - mat64 (Forum moderator)
    Last edited by mat64; 31-01-2006 at 09:38 PM.

  2. #2
    Coding4Newbs Guest

    Default

    you must not be editing it properly :rolleyes:

  3. #3
    Join Date
    Dec 2004
    Posts
    7,327
    Tokens
    2,081
    Habbo
    ---MAD---

    Latest Awards:

    Default

    check the config_radio.php and check if your configurations (pass, port ip etc) are correct.
    ---MAD---

  4. #4
    Coding4Newbs Guest

    Default

    remeber edit the bit where it says username 'edit here'!
    not the comments // user name here

  5. #5
    Join Date
    Jul 2005
    Location
    -
    Posts
    2,995
    Tokens
    0

    Latest Awards:

    Default

    Don't know if this will help but go to the tutorials section theres one in there.

  6. #6
    Join Date
    Jan 2005
    Posts
    99
    Tokens
    0

    Default

    Thanks for all the info, But still wont work , All the info such as radio IP and port are correct.
    The parse.php wont work, Is anyone willing to help me out if i give you the details needed please???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •