我正在创建一个音乐网站,我已经集成了SoundCloud API.
现在我想在运行时创建播放列表并将曲目附加到该播放列表.
我的代码如下:
class Soundcloud {
const VERSION = '1.1';
public static $urls = array(
'api' => 'http://api.soundcloud.com/',
'oauth' => array(
'access' => 'http://api.soundcloud.com/oauth/access_token',
'authorize' => 'http://soundcloud.com/oauth/authorize',
'request' => 'http://api.soundcloud.com/oauth/request_token'
)
);
function __construct($consumer_key, $consumer_secret, $oauth_token = null, $oauth_token_secret = null) {
$this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
$this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
$this->token = new OAuthConsumer($oauth_token, $oauth_token_secret);
} else {
$this->token = null;
}
}
function get_authorize_url($token) {
if (is_array($token)) {
$token = $token['oauth_token'];
} …Run Code Online (Sandbox Code Playgroud)