“无法验证您的身份。” -使用 Twitter OAuth 时出错

问题描述 投票:0回答:2

我正在使用 Twitter OAuth 构建我的第一个系统,但遇到了一些问题。

首先,我使用 Abraham 的 Twitter 类来实现此目的,并且我遵循了 this 教程。然而,我在我的callback.php 上得到了这些行:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\xampp\htdocs\twitter\twitterOAuth\OAuth.php on line 301

Warning: strtoupper() expects parameter 1 to be string, array given in C:\xampp\htdocs\twitter\twitterOAuth\OAuth.php on line 373
Oops - an error has occurred.
SimpleXMLElement Object
(
    [request] => /account/verify_credentials.xml
    [error] => Could not authenticate you.
)

这是 Twitter 类的问题,还是我做错了什么?正如教程所述,我在 config.php 中有我的消费者密钥和消费者秘密,但我应该存储其他内容吗?

马蒂莱恩

php twitter oauth
2个回答
6
投票

Snipe.net 教程适用于旧版本的 TwitterOAuth。请务必阅读新文档

http://github.com/abraham/twitteroauth/blob/master/DOCUMENTATION

总的来说,更新到新版本正在发生变化:

$content = $to->OAuthRequest('https://twitter.com/account/verify_credentials.xml', array(), 'GET');

至:

$content = $to->get('account/verify_credentials');


0
投票

我也遇到了同样的错误,是由一个简单的错误引起的:

不起作用:

$this->twitteroauth->post('statuses/update’, $message);

作品:

$this->twitteroauth->post('statuses/update', array("status" => $message));

© www.soinside.com 2019 - 2024. All rights reserved.