Wednesday, October 9, 2013

Twitter codeigniter-php library

I have created a Codeigniter library and a helper that would fetch the tweets from a twitter account and display it. You can find it here. The usage of this library is simple.
in your controller file just add the following to get the tweets.


   $params = array(
'userName'=>'your name',
'consumerKey'=>'your consumer key',
'consumerSecret'=>'your secret',
'accessToken'=>'your access token',
'accessTokenSecret'=>'your access token secret',
'tweetLimit'=>5,// the no of tweets to be displayed
);
$this->load->library('twitter',$params);
$tweets = $this->twitter->getHomeTimeLine();
$this->load->helper('tweet');
$mytweets = getTweetsHTML($tweets);
                echo $mytweets;

No comments:

Post a Comment