-
Notifications
You must be signed in to change notification settings - Fork 0
/
lastfm.php
34 lines (24 loc) · 872 Bytes
/
lastfm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
// Enter your LastFM username
$lastfm_user = 'mbriney';
?>
<style>
.album {font-size:11px; font-family:Arial; width: 64px; height: 140px; float:left; text-align: center; padding: 7px;}
</style>
<?php
$getlastfm = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=".$lastfm_user."&api_key=b25b959554ed76058ac220b7b2e0a026&limit=200";
$xml = simplexml_load_file($getlastfm);
$music = $xml->recenttracks->track;
for ($i = 0; $i < 200; $i++) {
echo "<div class='album'>";
echo "<a href='".$music[$i]->url."' target='_blank'>";
if ($music[$i]->image <> ''){
echo "<img src='".$music[$i]->image."' border='0' width='64' height='64'></a><br>";
} else {
echo "<img src='nocover.png' border='0' width='64' height='64'></a><br>";
}
echo "<b>".$music[$i]->artist . "</b><br>";
echo $music[$i]->name . "<br>";
echo "</div>";
}
?>