gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:35:47 27 4
gpt4 key购买 nike

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

我已经复制粘贴了自述文件中显示的示例代码,并将 YOURKEY 和 YOURSECRET 更改为我的应用程序的 key 和密码。

一切正常,但当我加载页面时,我收到一条消息:验证 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。结论:永远不要从不受信任的来源下载!

关于php - codebird-php 推特应用程序。验证 Twitter API 证书时出现错误 77,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17133262/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com