The other day I was approached by a friend (Julie Cheung) and asked if I could create some code that would display a list of last played tracks from last.fm. Julie isn't a PHP developer and so the code I gave her had to be easily understandable so that she could edit it herself if needed. The following code is what I came up with.
The code pulls from the defined user's "recenttracks" feed and parses it (via a simplexml_load_string call) into an object that's looped through and outputted. Data that comes back from the feed includes artist anme, name of the track, a URL to more information about it and an image of the album cover. He also includes an updated version that caches the data for three minutes so it's not always relying on the last.fm servers to be there.