Sound Cloud returning 401 error

♀尐吖头ヾ 提交于 2019-12-13 21:19:47

问题


Recently I start work with Sound cloud API (PHP) and I decided to use PHP API by

https://github.com/mptre/php-soundcloud.

But When I am trying to get access token from Sound cloud server by this code:

// Get access token
try {
    $accessToken = $soundcloud->accessToken(isset($_GET['code']));
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
    exit($e->getMessage());
}

The SC returning 401 error after adding below code in my script

$curlPath = 'Fullpath\Of\cacert.crt';

$curlSSLSertificate = str_replace(array('/', '\'), DIRECTORY_SEPARATOR, $curlPath);

curl_setopt($ch, CURLOPT_CAINFO, $curlSSLSertificate);

We added this code to fix "The requested URL responded with HTTP code 0" issue

and after this we are getting 401 error.

Is there any way to fix this problem. If yes then Kindly, suggest me to look out there..


回答1:


I think

$accessToken = $soundcloud->accessToken(isset($_GET['code']));

should read

$accessToken = $soundcloud->accessToken($_GET['code']);


来源:https://stackoverflow.com/questions/14647791/sound-cloud-returning-401-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!