PHP Photobucket》异常“权限不足”
感谢您查看我的代码。 我从 photobucket 收到权限不足的异常。我已将代码片段放在下面:
try {
$key = '45435xxxx';
$sec = 'xxxx98989';
$api = new PBAPI($key, $sec);
$api->login('request')->post()->loadTokenFromResponse();
/*----- authToken and oauth_token_secret-------*/
$authToken=$api->getOAuthToken()->getKey();
$oauth_token_secret=$api->getOAuthToken()->getSecret();
/*--Autehnication--*/
$api->setOAuthToken($authToken, $oauth_token_secret,"ricolifts");
$api->setResponseParser('simplexml');
$response = $api->album('testalbum')->upload(array('type' => 'image', 'uploadfile' => '@'.$path, 'title' => 'my upload'))->post()->getResponseString();
var_dump($response);
}
catch (PBAPI_Exception_Response $e) {
echo "RESPONSE $e";
}
catch (PBAPI_Exception $e) {
echo "EX $e";
}
我收到的错误是: 异常权限不足9 xml POST 1328766775
请帮助我。我缺少什么或者我的代码有什么问题。我是否缺少上传功能的参数? 我还缺少其他一些身份验证吗?子域名有什么作用吗?我可以使用 temp 作为专辑名称吗? 我提前表示感谢。 再次感谢
Thanks for looking at my code.
I am getting Insufficient permissions exception from photobucket. I have put my code snippet below:
try {
$key = '45435xxxx';
$sec = 'xxxx98989';
$api = new PBAPI($key, $sec);
$api->login('request')->post()->loadTokenFromResponse();
/*----- authToken and oauth_token_secret-------*/
$authToken=$api->getOAuthToken()->getKey();
$oauth_token_secret=$api->getOAuthToken()->getSecret();
/*--Autehnication--*/
$api->setOAuthToken($authToken, $oauth_token_secret,"ricolifts");
$api->setResponseParser('simplexml');
$response = $api->album('testalbum')->upload(array('type' => 'image', 'uploadfile' => '@'.$path, 'title' => 'my upload'))->post()->getResponseString();
var_dump($response);
}
catch (PBAPI_Exception_Response $e) {
echo "RESPONSE $e";
}
catch (PBAPI_Exception $e) {
echo "EX $e";
}
The error I am getting is:Exception Insufficient permissions 9 xml POST 1328766775
Please help me. What I am missing or what is wrong with my code. Am I missing a parameter to the upload function?
Is there some other authentication I missing ? Any role of subdomain ? Can I use temp as album name?
I appreciate in advance.
Thanks again
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是您正在使用的 Photobucket API 代码的开发人员。
您那里有一个请求令牌。您需要完成 Web 身份验证过程,让用户在 photobucket 中输入用户名和密码,并将该请求令牌交换为访问令牌。
请参阅 simple_demo.php https://bitbucket.org/photobucket/ api-php5-pear/src/1b31215ab83e/simple_demo.php 的示例这适用于该库。
I'm the developer of the Photobucket API code you're using.
You've got a Request token there. You need to go through the web authentication process to have a user input their username and password in photobucket, and exchange that request token for an access token.
See the simple_demo.php https://bitbucket.org/photobucket/api-php5-pear/src/1b31215ab83e/simple_demo.php for an example of how this works with that library.