View Full Version : Retrieving SHOUTcast Station Lists with PHP

04-04-2007, 05:35 PM
I am currently developing a website that is going to need to grab a list of the shoutcast stations, including name, description, genre, currently playing song, # listeners, bitrate and ip & port!

I have seen many programs that do this, but can't seem to find any instructions on how to do it with any webscripting languages.

The site is going to use alot of javascript and very few full page reloads, so I'm not going to be using tons of php, however I think it'd be good for getting the station information and mabye dynamically generating xml files with all the server information in it, which can then be used by the javascript.

Please help if you can!

Thanks :thumbsup:

04-04-2007, 05:38 PM
If the website puts out an rss feed, just use that and grap magpie to read it. If no rss feed is available, use file_get_contents and write a function to filter out what you need. Prolly have to do that for each site as all sites are different. But if there playlists, they should provide some type of feed?

04-04-2007, 05:44 PM
Those are both good ideas, i thought of them too ;)

However, they have no RSS feed and I haven't found any other sites besides Shoutcast.com that have a full list of all stations, and besides that, I can't get the full list since I can only view 20 stations at a time on one page (900 something pages total). So file_get_contents would have to be done multiple times, however It would be a possibility. Although this would not be my prefered way, I could have my team manually go through and write the xml by hand and then just have the code check it for broken links, and we'd update them as necessary, since we're probably not going to have ALL the stations.

Actually, as i'm writing this I think I have an idea. Since we're mostly going for bigger stations I could file_get_contents on their page if i sort it by popularity, i could grab the first two pages for each genre. That'd still take more code that I want, but it'd work.

04-04-2007, 06:02 PM
Na grab it all, filter it, put it in your database, then create the xml from that. Do it one time. Then put in some error checking for broken links and additions and have everything automated :). I love automation!