/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$cache_file = "/path/to/cache_file.htm"; $force_update = false; $username = "YOUR_USER_NAME"; $api_key = "YOUR_API_KEY"; $url = "http://ws.audioscrobbler.com/2.0/?format=json&method=user.getrecenttracks&"; $url .= "user=" . $username . "&api_key=" . $api_key; $data = @curlContents($url); echo '<ul>' . "\n"; foreach ($data['recenttracks']['track'] as $track) { echo '<li>' . $track['artist']['#text'] . ' - ' . $track['name'] . '</li>' . "\n"; } echo '</ul>' . "\n"; } } else { } echo $contents;