Created
December 3, 2013 12:37
-
-
Save tjhole/7768514 to your computer and use it in GitHub Desktop.
PHP: Lastfm - months top artists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This month we have been listening to | |
<?php | |
$username = 'tomhole1986'; | |
$itemCount = 5; | |
$month = 1; | |
$scrobbler_url = "http://ws.audioscrobbler.com/2.0/user/" . $username . "/topartists.xml?period=" . $month . "month&limit=" . $itemCount . ""; | |
$scrobbler_cache_file = 'scrobbler_' . $username . '_data.cache'; | |
if ($scrobbler_xml = file_get_contents($scrobbler_url)) { | |
$scrobbler_data = simplexml_load_string($scrobbler_xml); | |
foreach ($scrobbler_data->artist as $track) { | |
$string = ''; | |
$string .= $track->name; | |
$string .= ', '; | |
echo $string; | |
} | |
} ?> on Spotify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment