php - Sound Cloud Error -


Here's my redirect.php, I always get 'HTTP Error 500 (Internal Server Error): An Unexpected Condition The server was facing the request was trying to complete the request. '

PHP code:

  need_once' Services / Soundcloud.php '; // App credentials with client object $ client = new Services_Soundcloud ('xxxxxxxxxxxxxxxxxxxxxxx'); $ Customer & gt; SetAccessToken ($ _ [['code']); // Make a certified call $ current_user = json_decode ($ client- & gt; find ('me')); Print $ current_user- & gt; User name;   

Any ideas?

Thanks

start you new Services_Soundcloud Need to set the customer ID , customer service, and redirectURI argument.

Your code should look like this:

  index.php & lt ;? Create client objects with Php // app credentials ('service / soundcloud.fp'); $ Client = New Services Sqwocked ('....', '....', 'http://my.redirect.com/url.php'); $ AuthorizeUrl = $ client- & gt; GetAuthorizeUrl (); ? & Gt; & Lt; A href = "& lt ;? php echo $ authorize url ;? & gt;" & Gt; Connect with soundcloud & lt; / A & gt;   

and redirect URL:

  & lt; Php require_once ('Services / Soundcloud.fp'); // Client object with ap credentials $ client = new service sequoked ('.....', '.....', 'http://my.redirect.com/url.php'); {$ AccessToken = $ client- & gt; Try access token ($ _GET ['code']); Try {$ me = json_decode ($ client-> get ('me'), true); Var_dump (me $); } Hold (Services_Soundcloud_Invalid_Http_Response_Code_Exception $ e) {var_dump ($ e-> getMessage ()); Go out(); }} Catch (Services_ConnectCloud_Avali_HTP_Respons_Code_Exception $ E) {var_dump ($ e-> getMessage ()); Go out(); }? & Gt;   

You can get Customer ID and clientSecret

In addition to this, checkout for the appropriate example PHP, Python, Ruby and JS

You can check the code above at this link:


Comments