Get band's top songs from last.fm

Last.fm is great service. It provides a lot of information, which I find particularly useful for scenata.com. This is an example on how to get band’s top listened songs with the Audioscrobbler’s Webservices API using PHP’s XML Parser. The XML feed is formed as follows:

http://ws.audioscrobbler.com/1.0/artist/artistname/toptracks.xml

The function to use is <pre lang="php">function GetFromLastFm($bandname)</pre> and it returns an array of $bandname’s top listened songs. You may consider caching the results to reduce the server’s threshold.

Download: lastfmsongs.php.gz

Comments

comments powered by Disqus