Have you ever wanted to display your last.fm recent tracks (or any other last.fm info for that matter) on your own site? If you're using the Zend Framework, it's amazingly easy. The Zend_Service_Audioscrobbler class provides an easy way of using the Audioscrobbler web services.



First, if you're running ZF version 0.8.0 (the current release as of this posting) or earlier, download the latest version of the Zend_Service_Audioscrobbler class. The version in the 0.8.0 release has a small issue that has since been resolved.

Put these lines in your page/controller and set your username:
$as = new Zend_Service_Audioscrobbler();
$as->set('user''your_username');
$recentTracks $as->userGetRecentTracks();


Then pass the $recentTracks in to Smarty with your other stuff:
$smarty->assign('recentTracks'$recentTracks);


Create a Smarty template to display your list:
{foreach from=$recentTracks item=currItem}
    <
a href="{$currItem->url}"
>{$currItem->name}</a><br />
    {
$currItem->artist}<br />
{
foreachelse}
Silence
{/foreach}


Style to taste, and include it in your page template wherever you want to display it.

That's it!

I also wrote a more involved hack to get album info to match your recent tracks list, you can read about it here.