Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SoundCloudAPI 401_Php_Api_Soundcloud - Fatal编程技术网

Php SoundCloudAPI 401

Php SoundCloudAPI 401,php,api,soundcloud,Php,Api,Soundcloud,所以我尝试用SoundCloud API获取播放列表,但在设置访问令牌时得到了401 <?PHP require_once('Services/Soundcloud.php'); $client = new Services_Soundcloud('id', 'secret', 'uri'); if (!isset($_GET['code'])) { header("Location: " . $client->getAuthorize

所以我尝试用SoundCloud API获取播放列表,但在设置访问令牌时得到了401

<?PHP
    require_once('Services/Soundcloud.php');

   $client = new Services_Soundcloud('id', 'secret', 'uri');
    if (!isset($_GET['code']))
    {
        header("Location: " . $client->getAuthorizeUrl());
    }
    $access_token = $client->accessToken($_GET['code']);
    $client->setAccessToken($access_token);
?>


我想这可能是我重复使用访问令牌的问题(可能?)。我不确定。

解决这个问题的方法是简单地在“范围”中添加“非到期”,然后使用该代码

header("Location: " . $client->getAuthorizeUrl(array('scope' => 'non-expiring'));

不知什么原因,它又坏了。我收到以散列(
#
)结尾的代码,当我尝试使用
$\u get['code']
获取它们时,散列会被剥离。即使我手动附加散列,身份验证仍以401结尾,因此我假设这是一个内部错误。

这在我身上发生过几次,但突然停止了。至少可以说,他们的API服务不是最好的。