Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Location
    California
    Posts
    8,725
    Tokens
    3,789
    Habbo
    HotelUser

    Latest Awards:

    Default SHOUTcast Stats script I wrote

    I wrote this stats script for my own use, and to use within other scripts I'm writing. It's very easy to configure. Just change the host, port, and adminpass as instructed. I hope it can be of use to some of you!

    Paste this into a file called stats.php, you only need to change the password, and connection information and it will work:
    PHP Code:
    <?php
    /*-------------------------------------------------------------------------------------------------------------------------
    SHOUTcast stats script created by Macmee (HotelUser on HxF)
    Please change the settings below:
    -------------------------------------------------------------------------------------------------------------------------*/

    $host "111.111.1.11"# the IP address of your server
    $port "8000"#the port your server's on
    $adminpass "changeme"#the ADMINISTRATOR password

    //end of configuration. You shouldn't change anything beyond this point
    $fp fsockopen ($host$port$errno$errstr30);
    if (!
    $fp) {
        echo 
    "$errstr ($errno)<br>\n";
    } else {
        
    fputs ($fp"GET /admin.cgi?pass={$adminpass}&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
        while (!
    feof($fp)) {
            
    $content .= fgets ($fp,128);
        }
        
    fclose ($fp);
    }

    $status explode('<STREAMSTATUS>',$content);
    $status explode('</STREAMSTATUS>',$status[1]);
    if(
    $status[0] == 0)
        {
            die(
    '<center>Our radio is currently <font color=red><b>offline</b>!</font></center>');
        }
        
    $listeners explode('<CURRENTLISTENERS>',$content);
    $listeners explode('</CURRENTLISTENERS>',$listeners[1]);

    $maxlisteners explode('<MAXLISTENERS>',$content);
    $maxlisteners explode('</MAXLISTENERS>',$maxlisteners[1]);

    $servertitle explode('<SERVERTITLE>',$content);
    $servertitle explode('</SERVERTITLE>',$servertitle[1]);

    $song explode('<TITLE>',$content);
    for(
    $i=1$i<=10$i++)
        {
            
    $song[$i] = explode('</TITLE>',$song[$i]);
            
    $song[$i] = $song[$i][0];
        }

    echo 
    '<center>';
    echo 
    "<b>Listeners:</b> {$listeners[0]} / {$maxlisteners[0]}<br><br>";
    echo 
    "<b>Current DJ:</b> {$servertitle[0]}<br><br>";
    echo 
    "<b>Current Song:</b> {$song[1]}<br><br>";
    echo 
    "<b>Recent Songs:</b><br>";
    foreach(
    $song as $id => $value)
        {
            if(
    $id != && $id != 1)
                {
                    
    $display $id 1;
                    echo 
    "<b>{$display}</b>. {$value}<br>";
                }
        }
    echo 
    '</center>';
    ?>
    moderator alert Thread closed by Matts (Forum Super Moderator): Due to bump.
    Last edited by Matthew; 06-11-2012 at 06:39 PM.
    I'm not crazy, ask my toaster.

  2. #2
    Join Date
    Aug 2012
    Posts
    1
    Tokens
    0

    Wink

    Can u help me because this says the stats at my page:

    Warning: fsockopen() [function.fsockopen]: unable to connect to (privateIP sorry) (Connection timed out) in /home/u652848935/public_html/stats.php on line 12
    Connection timed out (110)
    Our radio is currently offline!

    (PrivateIP i deleted IP for safety)
    Last edited by Chris; 09-08-2012 at 02:21 PM.

  3. #3
    Join Date
    Jul 2004
    Location
    Ottawa, Canada
    Posts
    1,363
    Tokens
    106
    Habbo
    Yonder

    Latest Awards:

    Default

    @lezerdragon1; More than likely your host is blocking the port happens a lot on shared servers.


    Ooops i just realized this thread was from 2008 -.- sorry mods.
    Last edited by Yonder; 15-08-2012 at 05:53 PM.

  4. #4
    Join Date
    Nov 2011
    Posts
    67
    Tokens
    0

    Default

    Quote Originally Posted by lezerdragon1 View Post
    Can u help me because this says the stats at my page:

    Warning: fsockopen() [function.fsockopen]: unable to connect to (privateIP sorry) (Connection timed out) in /home/u652848935/public_html/stats.php on line 12
    Connection timed out (110)
    Our radio is currently offline!

    (PrivateIP i deleted IP for safety)
    having the same problem ;p

    SORRY This thread is from 08 My bad ;p
    Last edited by -Tyquan; 06-11-2012 at 05:39 PM.

Posting Permissions

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