Blackwolf Design
Twitter LinkedIn Facebook
Shoutcast Data Parser
By Phillip Long • Posted: June 5, 2009 • Applications & Components

This was a purpose-built script for a web radio site that wasn't satisfied with the existing methods of parsing stream data from a Shoutcast server. There are several methods of doing this which are well-documented on the internet, but all of them are complicated, outdated, and require a large amount of processing time for a relatively simple task: parsing an XML file.

Typically, methods for accomplishing this require interfacing with the Shoutcast server packet by packet via fsockopen() to send and receive HTML headers as if viewing the data via a webpage, and parsing the XML data on-the-fly manually using a series of complex regular expressions, resulting in very inflexible output that only the most skilled programmers can modify. While the fsockopen() interface with the server is difficult to avoid due to a limitation in the Shoutcast software, we were able to dramatically simplify the XML parsing process, making the data much easier for users and novice coders work with, and more flexible to use in output. The end result is a modern, modular script that outputs relevant content integrated with the radio info page, which can be adapted to the needs of any site.
Related Images
Shoutcast Data 2 - Shoutcast Parser, With Stream Shoutcast Data 1 - Shoutcast Parser, No Stream
 
Printed from Blackwolf Design. Visit us online at www.blackwolfdesign.net.