Documentation

Installation Instructions

======================
  Build Requirements
======================

libshout-2.1 or higher [http://icecast.org/download.php]
php-5.x or higher

=============================
  Installation Instructions
=============================

$ ./configure
$ make && make install

Note: if you have installed libshout to a non-default location, you can specify the location with:
$ ./configure --with-shout=/path/to/libshout/

If everything runs smoothly, you should now have a shout.so file in your php extension directory
(which configure tries to locate automatically.  Now that the extension is installed, you need to
copy the php.ini settings into your global php.ini

$ cat shout.ini >> /etc/php.ini

By default, phpShout IS configured to automatically load when PHP starts.  To prevent this from
happening, comment out this line in php.ini:

extension=shout.so

Example Usage

<?
/*
 * phpShout
 * example1.php
 *
 * $Id: docs.php 106 2006-10-30 06:16:25Z holbrookbw $
 */
if (!function_exists('shout_create')) dl('shout.so');

// Create Shout object and get Connection ID
$id = shout_create('/phpShout', 'source', 'hackme', SHOUT_FORMAT_MP3);

// Set station details, must be done BEFORE calling shout_open
shout_set_name($id, "This is the name of my Radio Station!");
shout_set_agent($id, "This is my UserAgent");
shout_set_description($id, "This is the description of my very own PHP radio station");

// Open connection
if (shout_open($id) != SHOUTERR_SUCCESS) die("Could not open connection\n");

// Open MP3 and set metadata
$file = '/path/to/mysong.mp3';
$fh = fopen($file, 'r');
shout_set_metadata($id, 'song', basename($file));

// Read MP3 data into buffer and send to server
$BUFF_SIZE = 4096;
while ($buff = fread($fh, $BUFF_SIZE)) {
  if ($buff === false) break;
  if (shout_send($id, $buff) != SHOUTERR_SUCCESS) {
    die("ERROR SENDING DATA\n");
  }
  // Wait for server to be ready for more data
  shout_sync($id);
}
// Song's over, close Shout connection and MP3 file
shout_close($id);
fclose($fh);
?>
Get Icecast and LibShout! Get Firefox2! SourceForge.net Logo