Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PHP Last.fm Chart Creator

DZone's Guide to

PHP Last.fm Chart Creator

·
Free Resource
This code displays the Top 50 artists XML feed from last.fm in a nice presentable way on your website. Can easily be modified to work with any other feed from last.fm, find the full guide at http://www.strydominc.za.net/index.php?p=projectdetail&d=phplastfmchart



  

  

  
needs your attention $user = "Alkine"; //Your username $width = 700; //width of the list //Code you should not worry about $file = "http://ws.audioscrobbler.com/1.0/user/$user/topartists.xml"; $xml = simplexml_load_file("$file"); $big = $xml->artist[0]->playcount; $total = count($xml->artist); $factor = $width /$big; ?> artist[$k]->playcount * $factor), 0); ?>
= (($width + 100) /2)) { echo "
", $xml->artist[$k]->playcount, " - ", $xml->artist[$k]->name ,"
"; } if (($barlen < (($width + 100) /2)) && ($barlen >= ($width / 3))) { echo "
", $xml->artist[$k]->playcount ," -
"; } if ($barlen < ($width / 3)) { echo " "; } ?>
= (($width + 100) /2)) { echo " "; } if (($barlen < (($width + 100) /2)) && ($barlen >= ($width / 3))) { echo "
 ", $xml->artist[$k]->name ,"
"; } if ($barlen < ($width / 3)) { echo "
", $xml->artist[$k]->playcount, " - ", $xml->artist[$k]->name ,"
"; } ?>
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}