-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
35 lines (26 loc) · 821 Bytes
/
example.php
File metadata and controls
35 lines (26 loc) · 821 Bytes
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
require_once 'officialfm.php';
$ofm = new OfficialFM();
?>
Track 27 of a track search for "Mac Miller":
<?php
$tracks = $ofm->tracks('Mac Miller', array('page' => 2))->tracks;
// 25 tracks per page
echo $tracks[1]->title.PHP_EOL;
?>
Track '1nnQ' is <?php $track = $ofm->track('1nnQ'); echo $track->title.' by '.$track->artist; ?>
Playlists corresponding to the term "mixtape":
<?php
$playlists = $ofm->playlists('mixtape')->playlists;
foreach ($playlists as $playlist) {
echo ' - '.$playlist->name.' ('.$playlist->tracks_count.' tracks)'.PHP_EOL;
}
?>
Playlist 2BHH is called <?php echo $ofm->playlist('2BHH')->name.PHP_EOL; ?>
It contains the following tracks:
<?php
$tracks = $ofm->playlist_tracks('2BHH');
foreach ($tracks as $track) {
echo ' - '.$track->title.PHP_EOL;
}
?>