Hello. I built a website that interfaces with the Twitter API. Recently I decided to transfer my entire website onto a framework (codeigniter).
My issue is as follows.
In my Models I have the following
Code:
public function settwconfig(){
$userid = $this->input->cookie("userid_cookie");
$this->load->config("twitter");
$this->load->library("TwitterOAuth");
if($_SESSION['username'] == "" OR $_SESSION['username'] == NULL) {
$sql = "SELECT * FROM `user_twtokens` WHERE `userid` = ?";
$query = $this->db->query($sql, $userid);
$row = $query->row();
$_SESSION['username'] = $row->username;
$_SESSION['oauth_uid'] = $row->oauth_uid;
$_SESSION['oauth_provider'] = $row->oauth_provider;
$_SESSION['oauth_token'] = $row->oauth_token;
$_SESSION['oauth_secret'] = $row->oauth_secret;
}
$twitteroauth = new TwitterOAuth($this->config->item('twitter_consumer_token'), $this->config->item('twitter_consumer_secret'), $_SESSION['oauth_token'], $_SESSION['oauth_secret']);
return $twitteroauth;
})
I use this method to initialize Twitter then call it in another function where I make a call like such:
Code:
public function feed() {
$twitteroauth = $this->settwconfig();
$feed = $twitteroauth->get('statuses/home_timeline', array('count' => 25));
return $feed;
})
When put in a view, the feed displays fine and I get all the tweets I want, but I get 4 errors saying that "Message: Missing argument 1 for TwitterOAuth::__construct()" and I have no idea why. The feeds are working fine but I don't understand how the class is errorirng out yet still giving me the feed.
The library I'm using is the following:
https://github.com/abraham/twitteroauth
This has been killing me. All help is welcome