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


codebird-php Twitter app. Error 77 while validating the Twitter API certificate

我试图使一个基本的应用程序与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,它不包括在我下载的包中。结论:不要从不可信的来源下载!

很高兴看到您的问题解决了。

顺便问一下,你最初是从哪里下载codebird的?