So, you’ve decided to start an internet radio station using shoutcast. You’ll probably want to advertise what’s playing on it right? Maybe you’ll want to show what song is playing on your website, or in an IRC channel. Well, I’ve got you covered.
It’s very simple to access a lot of information about a shoutcast server including the amount of listeners (current, max, and peak), the bitrate, and the current song. If you want to get a little more advanced, the XML version allows access to far, far, more data.
Here are some examples I wrote ages ago to get you started. There should not have been any major changes in the methods to access the data.
It’s very easy to start with the PHP /7.html version and do all sort of cool stuff, could pull album art from other sites (remember to cache!), link to places to purchase the song (referral $$), or just keep track of what songs get a lot of play time. It’s all up to you.
If you have any issues, concerns, or questions- feel free to ask them here.
Simple method – /7.html – [no authorization needed]
Advanced method – XML – [authorization needed]
There are a lot of reasons you may want to query an API for information about xbox live users. Perhaps you want to display information about yourself for your person site. Or maybe you want to create the gamercards a lot of people use for forums. Maybe you want to track usage, achievements, etc and graph it all. I’ve experimented with all three, using different methods of querying the data.
Normally, you can’t pull information about xbox live users unless you’re a member of the Xbox Community Developer Program (XCDP). That program, however, is fairly exclusive.
You could screen scrape profile pages on xbox.com, but that technique has many issues. To screen scrape xbox.com, you’ll have to create an extra account and keep track of session information between page requests. If there are ever any changes to the structure or design of the website, you may also have to completely rewrite the way your code is parsing it. On top of these -admittedly surmountable- issues, screen scraping isn’t the most friendly way of procuring data. In fact, it is very likely against the terms of service for xbox.com.
However, there is another way to access the information we want. Duncan Mackenzie, who is an XCDP member- hosts a public API to pull information about xbox live users. There are SOAP and REST versions of the API. While I’ve noticed a few rare issues with service availability, and issues with the data being stale- his API is perfect for most of the projects people will want to experiment with. Just make sure to cache the information, so you aren’t hammering his server with each request.
If you need something to get you started, I have a relatively simple example to use the data from the API. My code will also cache the data for fifteen minutes, though depending on your purposes I recommend increasing the cache time. While far from a complete solution, it should give you an idea of how to use the API for your own projects. Keep in mind however, that this specific example was whipped up relatively quickly- so there are many ways to improve upon it.
It appears that Duncan Mackenzie has taken this API down, so this code will not function as expected. I will leave the code available as a generic XML example.
View source (PHP)