Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (39 sloc) 1.08 KB
<?php
// Include the API
require '../../lastfmapi/lastfmapi.php';
// Get the session auth data
$file = fopen('../auth.txt', 'r');
// Put the auth data into an array
$authVars = array(
'apiKey' => trim(fgets($file)),
'secret' => trim(fgets($file)),
'username' => trim(fgets($file)),
'sessionKey' => trim(fgets($file)),
'subscriber' => trim(fgets($file))
);
$config = array(
'enabled' => true,
'path' => '../../lastfmapi/',
'cache_length' => 1800
);
// Pass the array to the auth class to eturn a valid auth
$auth = new lastfmApiAuth('setsession', $authVars);
// Call for the album package class with auth data
$apiClass = new lastfmApi();
$albumClass = $apiClass->getPackage($auth, 'album', $config);
// Setup the variables
$methodVars = array(
'album' => 'In Rainbows',
'page' => 1,
'limit' => 10
);
if ( $results = $albumClass->search($methodVars) ) {
echo '<b>Data Returned</b>';
echo '<pre>';
print_r($results);
echo '</pre>';
}
else {
die('<b>Error '.$albumClass->error['code'].' - </b><i>'.$albumClass->error['desc'].'</i>');
}
?>
Jump to Line
Something went wrong with that request. Please try again.