+ Reply to Thread
Results 1 to 7 of 7

Thread: Shoutcast Stats Help!!!

  1. #1
    SEŅOR's Avatar
    SEŅOR is offline The Guy Everyone Hates SEŅOR is an unknown quantity at this point
    Join Date
    Nov 2005
    Location
    Toronto
    Posts
    2,319

    Shoutcast Stats Help!!!

    Hey I am trying to get my shoutcats stas working but it wont load it says there is an error. Can any1 help me set this up. I will give 25 Points to whoever gets it up for me.

    It us currently located at

    1) http://www.randomtr.x10hosting.com/s...adio_stats.php
    or
    2) http://www.randomtr.x10hosting.com/s...sv21/radio.php

    #2 has the radio and supposed to have stats. I just need stats to work tho.

    Youtube Channel | Website

    // SEŅOR BERNS //

  2. #2
    SEŅOR's Avatar
    SEŅOR is offline The Guy Everyone Hates SEŅOR is an unknown quantity at this point
    Join Date
    Nov 2005
    Location
    Toronto
    Posts
    2,319

    Re: Shoutcast Stats Help!!!

    Bump Please

    Youtube Channel | Website

    // SEŅOR BERNS //

  3. #3
    Brandon Guest

    Re: Shoutcast Stats Help!!!

    Can you show me the code? The download link?

    Edit: It wont show anything unless the radio is on.

    PHP Code:
    Warningfsockopen(): unable to connect to 72.142.194.142:2962 in /home/randomtr/public_html/shoutcast_statsv21/radio_stats.php on line 7  Due to me not having the admin password of any shoutcast serversno details can be displayed in this demo is Offline 
    Last edited by Enigma; 03-02-2006 at 04:54 PM.

  4. #4
    SEŅOR's Avatar
    SEŅOR is offline The Guy Everyone Hates SEŅOR is an unknown quantity at this point
    Join Date
    Nov 2005
    Location
    Toronto
    Posts
    2,319

    Re: Shoutcast Stats Help!!!

    Radio is on nothing... STill error. Also It should say Radio Offline when theres no music. How do i post a download link?

    Youtube Channel | Website

    // SEŅOR BERNS //

  5. #5
    Brandon Guest

    Re: Shoutcast Stats Help!!!

    I modified my friends code

    Change 'nopassword' to your SHOUTcast password

    PHP Code:
     <?php
    error_reporting
    (0);
    define ("DEBUG""0");
    $shoutcast_host '72.142.194.142';  // SHOUTcast station url
    $shoutcast_port '2962';      // SHOUTcast station port number
    $shoutcast_password 'nopassword';  // SHOUTcast password
    $shoutcast_url "http://" $shoutcast_host ':' $shoutcast_port "/listen.pls";
    $fsock_time_out 1;
    $fsock_error_number 0;
    $fsock_error_text "";
    $shoutcast_data = array('streamstatus' => '',
                            
    'bitrate' => ''
                            
    'currentlisteners' => ''
                            
    'maxlisteners' => '',
                            
    'servertitle' => ''
                            
    'songtitle' => '');
    $shoutcast_xml "";
    global 
    $shoutcast_data$shoutcast_xml_element;
    if (!
    function_exists('startElement')) {
      function 
    startElement($parser$name$attrs) {
          global 
    $shoutcast_xml_element;
          
    // track which xml element is being parsed
          
    $shoutcast_xml_element strtolower($name);
      }
    }
    if (!
    function_exists('endElement')) {
      function 
    endElement($parser$name) {
          global 
    $shoutcast_xml_element;
          
    // forget which xml element was being parsed
          
    $shoutcast_xml_element '';
      }
    }
    if (!
    function_exists('handleData')) {
      function 
    handleData($parser$data) {
          global 
    $shoutcast_data$shoutcast_xml_element;
          
    $shoutcast_data[$shoutcast_xml_element] .= $data;
      }
    }
    if (!
    function_exists('defaultHandler')) {
      function 
    defaultHandler($parser$data) {}
    }
    $shoutcast_fp fsockopen($shoutcast_host,
                              
    $shoutcast_port
                              
    $fsock_error_number,
                              
    $fsock_error_text,
                              
    $fsock_time_out);
    if(
    $shoutcast_fp) {
        
    // socket connection is established, so the station is on-line
        // set 1 second timeout for communication with the station
        // stream_set_timeout($shoutcast_fp, 1);
        
        // build a string containing an HTTP request to your SHOUTcast server
        
    $shoutcast_httpreq "GET /admin.cgi?pass=$shoutcast_password&mode=viewxml
          HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"
    ;
        
    // send HTTP request to shoutcast server
        
    fputs($shoutcast_fp$shoutcast_httpreq);
        
    // read entire xml output stream
        
    while(!feof($shoutcast_fp)) {
            
    $shoutcast_xml .= fgets($shoutcast_fp1000);
        }
      
        
    // close the socket now we no longer need it
        
    fclose($shoutcast_fp);
        
    // if we have got some XML back  then we need to strip away some
        // stuff that we don't need  
        
    if ($shoutcast_xml != '')
            
    $shoutcast_xml strstr($shoutcast_xml'<SHOUTCASTSERVER>');
        
    // create an instane of the EXPAT XML parser
        
    $xml_parser xml_parser_create();
        
    // set element start and end element handler functions
        
    xml_set_element_handler($xml_parser'startElement''endElement');
        
    // set character data handler function
        
    xml_set_character_data_handler($xml_parser'handleData');
      
    xml_set_default_handler($xml_parser'defaultHandler');
      
        
    // activate the XML parser
      
    $parsed xml_parse($xml_parser$shoutcast_xml1);
        
    // some debugging code
        
    if (DEBUG) {
            echo 
    $shoutcast_xml;
            
    print_r ($shoutcast_data);
        }
        
    // check that the parsing operation worked correctly
        
    if ($parsed) {
            
    // it worked, so report the station status
            
    if ($shoutcast_data['streamstatus'] == '1') {
        
            
    // streaming content is available
            
    echo '<p>';
            echo 
    $shoutcast_data['servertitle'];
            echo 
    '<br />Streaming at ';
            echo 
    $shoutcast_data['bitrate'];
            echo 
    ' kbps.</p>';
            echo 
    '<p>Currently playing: ';
            echo 
    $shoutcast_data['songtitle'];
            echo 
    '</p>';
            echo 
    '<p>Current listeners: ';
            echo 
    $shoutcast_data['currentlisteners'];
            echo 
    ' (only ';
            echo 
    $shoutcast_data['maxlisteners'];
            echo 
    ' allowed).</p>';
            if (
    intval($shoutcast_data['currentlisteners']) 
                 < 
    intval($shoutcast_data['maxlisteners'])) {
                 echo 
    "<p>If you have Real Player installed, then ";
                 echo 
    "click the Play button on the console above. ";
                 echo 
    "Otherwise, to listen using Winamp ";
                 echo 
    "click <a href=\"$shoutcast_url\">here</a>.</p>";
            } else {
                 echo 
    "<p>Please wait until another listener can be added.</p>";
            }
            } else {
                
    // no streaming content is available
                
    echo '<p>The station is online but service has been interrupted.</p>';
            }
            
        }
        else {
            
    // parsing failed
          
    if (DEBUG) {
              echo 
    'XML Parser reported the following error:' '<br />';
              echo 
    xml_error_string(xml_get_error_code($xml_parser)) . ' in line ';
              echo 
    xml_get_current_line_number($xml_parser) . '<br />';
          }
        }
        
    // the xml parser is no longer required
        
    xml_parser_free($xml_parser);
    } else {
        
    // socket connection could not be established
        
    echo '<p>The station is offline.</p>';
    }
    ?>

  6. #6
    SEŅOR's Avatar
    SEŅOR is offline The Guy Everyone Hates SEŅOR is an unknown quantity at this point
    Join Date
    Nov 2005
    Location
    Toronto
    Posts
    2,319

    Re: Shoutcast Stats Help!!!

    Thankyou m8.

    Youtube Channel | Website

    // SEŅOR BERNS //

  7. #7
    SEŅOR's Avatar
    SEŅOR is offline The Guy Everyone Hates SEŅOR is an unknown quantity at this point
    Join Date
    Nov 2005
    Location
    Toronto
    Posts
    2,319

    Re: Shoutcast Stats Help!!!

    Scripts up radio is online it just says its foffline tho.?

    Youtube Channel | Website

    // SEŅOR BERNS //

+ Reply to Thread

Similar Threads

  1. Replies: 2
    Last Post: 09-14-2006, 05:19 AM
  2. ShoutCast Radio Stats Script
    By TheJeffsta in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 05-18-2006, 11:13 PM
  3. Ad's on VSP Stats
    By Wolfdude in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 05-11-2006, 03:44 PM
  4. CS:S Sig stats?!
    By minievan in forum Gamer's Lounge
    Replies: 1
    Last Post: 02-05-2006, 04:30 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
x10hosting free hosting for the masses
dedicated servers