阿比的SoundCloud错误 [英] Soundcloud Api Error

查看:169
本文介绍了阿比的SoundCloud错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图按照在PHP中使用的SoundCloud API的用户。
但我正在逐渐娄错误,当我运行code。

I was trying to follow a user using soundcloud api in php. But I am getting bellow error when i run the code.

警告:缺少论据2 Services_Soundcloud :: put()方法,称为
  /home/sumithost/public_html/test.php上线12
  在/home/sumithost/public_html/Soundcloud.php定义上
  行636

Warning: Missing argument 2 for Services_Soundcloud::put(), called in /home/sumithost/public_html/test.php on line 12 and defined in /home/sumithost/public_html/Soundcloud.php on line 636

例外Services_Soundcloud_Invalid_Http_Response_ code_Exception'与
  消息请求的URL回应 HTTP code 404 。在
  /home/sumithost/public_html/Soundcloud.php:941堆栈
  跟踪:0#
  /home/sumithost/public_html/Soundcloud.php(645):
  Services_Soundcloud - > _请求(的https://api.sou ...',阵列)#1
  /home/sumithost/public_html/test.php(12):
  Services_Soundcloud->把('/ ME /以下/ ...')#2主{}例外

exception 'Services_Soundcloud_Invalid_Http_Response_Code_Exception' with message 'The requested URL responded with HTTP code 404.' in /home/sumithost/public_html/Soundcloud.php:941 Stack trace: #0 /home/sumithost/public_html/Soundcloud.php(645): Services_Soundcloud->_request('https://api.sou...', Array) #1 /home/sumithost/public_html/test.php(12): Services_Soundcloud->put('/me/followings/...') #2 {main}exception

我的code低于
    

My Code is below

require_once 'Soundcloud.php';

$client = new Services_Soundcloud('xxClient-IDxx', 'xxSecretKEYxx', 'http://sumithost.uni.me/sc.php');


$client->setAccessToken('xxAccess-Tokenxx');    


try {
$client->put('/me/followings/3207');
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
    echo $e;
}
?>

从这里使用PHP SDK: https://github.com/mptre/php-soundcloud

我认为错误是在soundcloud.php看跌功能:636

推荐答案

put方法需要第二个参数。在文档块注释的描述是错误的。

The put method needs a second argument. The description in the docblock comment is wrong.

/**
 * Send a PUT HTTP request
 *
 * @param string $path        Request path
 * @param array  $postData    Optional post data
 * @param array  $curlOptions Optional cURL options
 *
 * @return mixed
 *
 * @access public
 * @see Soundcloud::_request()
 */

function put($path, $postData, $curlOptions = array())

我觉得用''(空字符串)作为第二个参数应该做的伎俩。

I think using '' (empty string) as second argument should do the trick.

编辑:没有意识到文档块表示,其可选的。不是这样。

Didn't realize the docblock said its optional. It is not.

这篇关于阿比的SoundCloud错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆