-
Notifications
You must be signed in to change notification settings - Fork 2
/
lfm.php
68 lines (64 loc) · 2.54 KB
/
lfm.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en">
<head>
<?php
include("res/php/auth.php");
include("res/php/loadfunc.php");
include("res/php/links.php");
?>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="./index.php">JamWalkr</a>
<ul class="nav">
<li><a href="./index.php"><i class="icon-home icon-white"></i></a></li>
<li class="active"><a href="./lfm.php"><i class="icon-music icon-white"></i></a></li>
<li><a href="./8tracks.php"><i class="icon-headphones icon-white"></i></a></li>
<li><a href="./map.php"><i class="icon-map-marker icon-white"></i></a></li>
<li><a href="./database.php"><i class="icon-hdd icon-white"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="container-fluid" style="margin-top: 50px;">
<div class="row-fluid">
<div class="span3 visible-desktop">
<ul class="nav nav-pills nav-stacked">
<li><a href="./index.php"><i class="icon-home"></i> Home</a></li>
<li class="active"><a href="./lfm.php"><i class="icon-music"></i> Last.fm API</a></li>
<li><a href="./8tracks.php"><i class="icon-headphones"></i> 8Tracks API</a></li>
<li><a href="./map.php"><i class="icon-map-marker"></i> Google Maps API</a></li>
<li><a href="./database.php"><i class="icon-hdd"></i> MySQL Database</a></li>
</ul>
</div>
<div class="span9">
<h1>Last.fm API</h1>
<?php
# var_dump(curl_version());
$lfmmethod = "chart.getTopArtists";
$url = $lfmbase . "?method=" . $lfmmethod . $lfmkey;
echo "<p class='lead'>" . $lfmmethod . "</p>";
$response = get_page($url);
$xml = new SimpleXMLElement($response);
$data = $xml->artists->artist;
for ($i = 0; $i < sizeof($data); $i++) {
$name = (string) $data[$i]->name;
$link = (string) $data[$i]->url;
$img = $data[$i]->children();
$img = (string) $img->image[3];
echo "<div class='media'>";
echo "<a href='" . $link . "' class='pull-left' target='_blank
'>";
echo "<img src='" . $img . "' alt='" . $name . "' class='media-object thumbnail'/></a>";
echo "<div class='media-body'>";
echo "<h2 class='media-heading'>" . $name . "</h2>";
echo "</div></div>";
}
#echo "<pre>" . var_dump($xml) . "</pre>"; ?>
</div>
</div>
</div>
</body>
</html>