duanjuan3931 2017-04-09 01:44
浏览 43

我无法使用Twitter登录库检索请求令牌

I was attempting to implement the Twitter login library located here: https://github.com/abraham/twitteroauth

I have followed a couple tutorials line by line just to see if I could get it working, but it gives me:

"This page isn’t working. MyWebsite.com is unable to handle this request."

After looking through the code and trying some things, I realized the line that is causing it is this one in this picture:

<?php
session_start();
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;

define('CONSUMER_KEY', 'BlaBlaBlaBla'); // add your app consumer key between single quotes
define('CONSUMER_SECRET', 'BlaBlaBlaBla'); // add your app consumer secret key
between single quotes
define('oAUTH_CALLBACK', 'BlaBlaBlaBla/twitter/callback.php'); // your app callback URL

if (lisset($_SESSION['access_token'])) {
    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
    $request_token : $connection->oauth('oauth/request_token', array('oauth_callback' => oAUTH_CALLBACK));
    $_SESSION['oauth_token'] : $request_token['oauth_token'];
    $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
    $url : $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
    echo $url;
} else {
    $access_token = $_SESSION['access_token'];
    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token[
    oauth_token_secret']);
    $user : $connection->get("account/verify_credentials")fl
    echo $user->screen_name;
}
?>

Code image:

enter image description here

If anyone has any experience with this and could help, it would be really helpful.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录