I don't know why but I cannot get this to show me any results. I think it has something to do with the "if(isset.." statement. ALSO i keep getting this error and have no idea what it means.
Warning: http_build_query() [function.http-build-query]: Parameter 1 expected to be Array or Object. Incorrect value given in /home/content/98/11283098/html/Soundcloud.php on line 796
<?php
session_start();
//session_destroy();
require "Soundcloud.php";
$soundcloud = new Services_Soundcloud('b2d68263b3f0b55fc00edb19e95c0560', '0fd9a8f7bfac3f954b9b74db8d94a453', 'http://themusicmeter.net/CLOUDBETA.php');
$soundcloud->setDevelopment(false);
$authURL = $soundcloud->getAuthorizeUrl();
echo '<pre>';
echo "<a href='$authURL'>Connect to Soundcloud</a>";
//Attempt to get token from Session First
//Set the token otherwise...
try {
if (!isset($_SESSION['token'])) {
$accessToken = $soundcloud->accessToken($_GET['code']);
$_SESSION['token'] = $accessToken['access_token'];
print_r($accessToken);
}
else{
$soundcloud->setAccessToken($_SESSION['token']);
}
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
exit($e->getMessage());
}
try {
$me = json_decode($soundcloud->get('me'), true);
print_r($me);
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
exit($e->getMessage());
}