codebird-php Twitter应用程序。在验证Twitter API证书时出现错误77。

5
我正在尝试制作一个基本的应用程序,该应用程序使用库codebird-php(https://github.com/mynetx/codebird-php)进行身份验证,并代表用户发布消息。我已经复制了readme中显示的示例代码,并将YOURKEY和YOURSECRET更改为我的应用程序密钥和密钥。一切都应该正常工作,但当我加载页面时,我收到一条消息:验证Twitter API证书时出错77。我无法在google上找到此错误类型...其含义很明显,但我不知道如何解决它。有什么想法吗?以下是代码:
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']);
2个回答

5
解决了,我需要拥有.pem文件,但我下载的软件包中并没有这个文件。结论:永远不要从不可信的源下载!

由于某种原因,我的文件从.pem变成了.cer。 - A F

0
很高兴看到这解决了你的问题。
顺便问一下,你最初是从哪里下载的codebird?

请提供最简单的检索Twitter时间线和标签的方法 - Twitter OAuth API 1.1 - Adam Monsen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接