<?php
 
    // include library
 
    require ('bmShoutCastInfo.class.php');
 
 
    try {
 
        // instantiate bmShoutCastInfo class, automatically connecting to the shoutcast
 
        // server, retrieving the data
 
        $shoutCastInfo = new bmShoutCastInfo('my-station.com',8080,'myadminpass');
 
    
 
        // the data can now be accessed.
 
    
 
        if ( $shoutCastInfo->getStreamStatus() == bmShoutCastInfo :: STREAM_STATUS_OFFLINE ) {
 
            die ('The shoutcast server is currently offline.');
 
        } else {
 
            // the server is online, we can read the data now
 
            
 
            $currentListeners = $shoutCastInfo->getCurrentListeners();
 
            $maxListeners = $shoutCastInfo->getMaxListeners();
 
            
 
            echo $currentListeners . ' of a maximum of ' . $maxListeners . ' listening.';
 
        }
 
    } catch ( bmShoutCastException $e ) {
 
        die ('An error occurred: ' . $e->getMessage());
 
    }
 
    
 
?>
 
 
 |