PHP Classes

File: bmShoutCastInfo/shoutcast_example.php

Recommend this page to a friend!
  Classes of Jan-Simon Winkelmann   bmShoutCastInfo   bmShoutCastInfo/shoutcast_example.php   Download  
File: bmShoutCastInfo/shoutcast_example.php
Role: Example script
Content type: text/plain
Description: example script
Class: bmShoutCastInfo
Retrieve status information from Shoutcast servers
Author: By
Last change:
Date: 18 years ago
Size: 845 bytes
 

Contents

Class file image Download
<?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());
    }
   
?>