微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

codebird-php Twitter应用程序.验证Twitter API证书时出错77

我正在尝试创建一个基于Twitter的身份验证的基本应用程序,并通过库codebird-PHP(https://github.com/mynetx/codebird-php)代表用户发布消息

我已经复制了自述文件显示的示例代码,并使用我的应用程序的密钥和密码更改了YOURKEY和YOURSECRET.

一切都应该工作正常,但当我加载我的页面时,我收到一条消息说:
验证Twitter API证书时出错77.

我无法在谷歌的任何地方找到这种错误类型……意思很明显,但我不知道如何解决它.有什么想法吗?

代码如下:

require_once ('codebird.PHP');
\Codebird\Codebird::setConsumerKey('YOURKEY', 'YOURSECRET'); // I changed it to my   settings

$cb = \Codebird\Codebird::getInstance();
session_start();

if (! isset($_SESSION['oauth_token'])) {
// get the request token
$reply = $cb->oauth_requestToken(array(
    'oauth_callback' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']
));

// store the token
$cb->setToken($reply->oauth_token, $reply->oauth_token_secret);
$_SESSION['oauth_token'] = $reply->oauth_token;
$_SESSION['oauth_token_secret'] = $reply->oauth_token_secret;
$_SESSION['oauth_verify'] = true;

// redirect to auth website
$auth_url = $cb->oauth_authorize();
header('Location: ' . $auth_url);
die();

} elseif (isset($_GET['oauth_verifier']) && isset($_SESSION['oauth_verify'])) {
// verify the token
$cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
unset($_SESSION['oauth_verify']);

// get the access token
$reply = $cb->oauth_accesstoken(array(
    'oauth_verifier' => $_GET['oauth_verifier']
));

// store the token (which is different from the request token!)
$_SESSION['oauth_token'] = $reply->oauth_token;
$_SESSION['oauth_token_secret'] = $reply->oauth_token_secret;

// send to same URL, without oauth GET parameters
header('Location: ' . basename(__FILE__));
die();
}

// assign access token on each page load
$cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);

解决方法:

解决了,我必须有.pem,它没有包含在我下载的软件包中.结论:永远不要从不受信任的来源下载!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐