我正在使用 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 中有我的消费者密钥和消费者秘密,但我应该存储其他内容吗?
马蒂莱恩
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');
我也遇到了同样的错误,是由一个简单的错误引起的:
不起作用:
$this->twitteroauth->post('statuses/update’, $message);
作品:
$this->twitteroauth->post('statuses/update', array("status" => $message));