我尝试使用以下代码,但它显示错误,上面写着:
代码:
if (isset($_GET['code']))
{
$soundcloud->_validResponseCode($_GET['code']);
$_SESSION['access_token'] = $soundcloud->accessToken($_GET['code']);
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
ERROR:
Fatal error: Call to protected method Services_Soundcloud::_validResponseCode()
答案 0 :(得分:0)
使用try catch块,然后从异常中获取http代码,例如:
// check the status of the relationship
try {
$client->get('/me/followings/3207');
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
if ($e->getHttpCode() == '404')
print "You are not following user 3207\n";
}