Jump to content

Desperately need help with soundcloud API


hunt22101

Recommended Posts

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());

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.