1

尝试在 codeigniter 中使用 Twitter 进行身份验证。它去推特并回来但给出错误。这是错误和代码。任何提示?

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$request
Filename: libraries/tweet.php
Line Number: 205

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$error
Filename: libraries/tweet.php
Line Number: 205

bool(false)

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: friendship
Filename: controllers/tweet_connect.php
Line Number: 63

这是代码;

function index()
    {
        echo 'hi there';
    }

  function auth()
  {
    $tokens = $this->tweet->get_tokens();

    // $user = $this->tweet->call('get', 'account/verify_credentiaaaaaaaaals');
    // 
    // Will throw an error with a stacktrace.

    $user = $this->tweet->call('get', 'account/verify_credentials');
    var_dump($user);

    //$friendship   = $this->tweet->call('get', 'friendships/show', array('source_screen_name' => $user->screen_name, 'target_screen_name' => 'elliothaughin'));
    //var_dump($friendship);

    if ( $friendship->relationship->target->following === FALSE )
    {
    //$this->tweet->call('post', 'friendships/create', array('screen_name' => $user->screen_name, 'follow' => TRUE));
    }

    //$this->tweet->call('post', 'statuses/update', array('status' => 'Testing #CodeIgniter Twitter library by @elliothaughin - http://bit.ly/grHmua'));

    $options = array(
    'count' => 10,
    'page'  => 2,
    'include_entities' => 1
    );

    //$timeline = $this->tweet->call('get', 'statuses/home_timeline');

    //var_dump($timeline);
  }
4

1 回答 1

1

您可能正在使用旧库:https ://github.com/elliothaughin/codeigniter-twitter/pull/25#commitcomment-1988684

您可能已达到请求限制:Elliot Haughin API verify credentials error

自从大约 2 年前发布该库以来,twitter api 也发生了很多变化——该库可能在​​当前状态下不再工作。

可能想查看 twitter 提供的库:https ://dev.twitter.com/docs/twitter-libraries#php

于 2012-11-13T17:43:22.970 回答