Search code examples
phpcodeignitertwittercodeigniter-2

Get tweets from specific user with Code Igniter


I'm trying to get tweets from a specific user but can't find a way to do this from within Code Igniter. I saw several pages looking for solutions like:

But all of them seems to be for authorization and not for get tweets. Any help or advice on this topic?


Solution

  • Use this library on github :

    TwitterFetecher for codeigniter and Read the documenation

    Place TwitterFetcher.php on libraries folder .

    on your controller /action load it

    public function home() {
    $this->load->library('twitterfetcher');
    
            $tweets = $this->twitterfetcher->getTweets(array(
                'consumerKey'       => 'yourkey',
                'consumerSecret'    => 'yourkey',
                'accessToken'       => 'yourkey',
                'accessTokenSecret' => 'yourkey',
                'usecache'          => true,
                'count'             => 2,  //this how many tweets to fectch
                'numdays'           => 30
            ));
        $data['twiites'] = $tweets  ; 
      $this->load->view('home/home',$data);
     }
    

    CHAW!