rendered paste bodyfunction lastfm_weekly_artists($user) { $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, "http://ws.audioscrobbler.com/1.0/user/$user/weeklyartistchart.xml"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $url = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string("$url"); if (!isset($xml->artist)) { echo "No stats to list."; } else { echo "<ul>\n"; foreach ($xml->artist as $artist) { echo "<li><a href=\"$artist->url\" title=\"$artist->name\">$artist->name</a> - $artist->playcount</li>\n"; } echo "</ul>\n"; }}