Minded Systems

PHP: IceCast Object Class

In addition to modifying an old version of a ShoutCast PHP object to allow for communication with Shoutcast streaming audio servers, a similar object was created for the same communication with Icecast streaming audio servers. The IceCast object class was built off of the ShouCast object class, following the same coding practices. Many of the same functions are available in both objects, however, some differences in the data provided by the different server types makes for some functionality discrepancies.

Currently this object class is only designed to support single stream Icecast servers. Unlike the Shoutcast streaming service, Icecast can have multiple streams per instance of the program. Each stream is identified by a unique mount-point name. The IceCast returns the data for these streams in an ordered list. The object’s functions return the data associated with the first stream (or mount-point) in the list provided by the server.

Once the PHP class file has been included, the IceCast() function can be used to build a new IceCast object. Here’s some example code of how to make use of the object class:

$i = new IceCast();
$i->host = 'streamipordomain.com';
$i->port = '8000'; //port stream is broadcast on
$i->passwd = 'adminPa$$'; //stats admin password

if($i->openstats()) {
  if($i->getStreamStatus()) {
    //stream is online and information loaded
  } else {
    //stream is offline
  }
} else {
  //server could not be connected to or is offline
}

Built along the same structure as the ShoutCast object, the IceCast object also offers reliable connections and a simple, easy use interface.

Hello mate, i am trying your class, but i always get as if the server was offline…

any advise ?
http://www.orderofdoom.com/downloads/radio/lp.php

January 19, 2011 CoronelN

Tried the script and it works great. Thank you for it. But I need the start for the mount points not the complete stats.

What about statistics per mount point? If this is possible how can I do it with your class or I need to add something fist? Thank you for your time.

May 9, 2012 Zoran Dimovski

@Zoran

Thanks for the comment. I’m glad you are getting some use out of the IceCast object. I will re-look into the IceCast API and see if i can provide an updated version to pull specific mount-point statistics.

May 9, 2012 Tyler Winfield
Please provide a valid email address

Trackback URL

http://www.minded.ca/2009-09-25/php-icecast-object-class/trackback/

  • […] ensure successful integration into existing systems. Using both the ShoutCast object class and the IceCast object class as building models, a simple PHP object class has been built for basic data […]