elliothaughin / codeigniter-twitter Goto Github PK
View Code? Open in Web Editor NEWTwitter API library for CodeIgniter
Twitter API library for CodeIgniter
Has anyone gotten this Library to work? I see so many issues in here that seem unresolved. I've also reached out to Elliot through multiple means but it doesn't seem like he supports these Libraries.
If anyone has had any luck getting these Libraries to work (Twitter/Facebook) I'd really appreciate a ping to my personal GitHub account (willing to pay if it gets to that).
Thanks.
BTW, as far as the issue I'm having, the same as everyone else - the Library just keeps asking Twitter over and over for tokens and always says they are expired. I've applied the patch too.
I am using this library and getting this error & Exception can anybody look into this ?
Severity: Notice
Message: Undefined property: stdClass::$request
Filename: libraries/tweet.php
Line Number: 207
exception 'tweetException' with message '401 | Request Failed: - ' in D:\xampp\htdocs\jazibpro\application\libraries\tweet.php:207
Stack trace:
#0 D:\xampp\htdocs\jazibpro\application\libraries\tweet.php(174): tweetConnection->_getResponse('Resource id #44')
#1 D:\xampp\htdocs\jazibpro\application\libraries\tweet.php(131): tweetConnection->_addCurl('http://api.twit...', Array)
#2 D:\xampp\htdocs\jazibpro\application\libraries\tweet.php(509): tweetConnection->post('http://api.twit...', Array)
#3 D:\xampp\htdocs\jazibpro\application\libraries\tweet.php(338): tweetOauth->_httpRequest('POST', 'http://api.twit...', Array)
#4 [internal function]: tweetOauth->call('post', 'statuses/update', Array)
#5 D:\xampp\htdocs\jazibpro\application\libraries\tweet.php(19): call_user_func_array(Array, Array)
#6 [internal function]: tweet->__call('call', Array)
#7 D:\xampp\htdocs\jazibpro\application\controllers\ajax\test.php(602): tweet->call('post', 'statuses/update', Array)
#8 [internal function]: Test->posttweet()
#9 D:\xampp\htdocs\jazibpro\system\core\CodeIgniter.php(325): call_user_func_array(Array, Array)
#10 D:\xampp\htdocs\jazibpro\index.php(201): require_once('D:\xampp\htdocs...')
#11 {main}
Hello. "statuses/update" success response returns previous tweet id from timeline instead of just tweeted. And if the timeline is empty then response is Null because there is no previous message from which to get an id.
Hello Elliot,
First I'd love to say this Library looks like it's got a ton of potential. I can't wait to get it working.
The reason I can't seem to get it working has been outlined by a couple of others already, though incorporating their fixes hasn't yielded any results.
http://twitterscap.es/tweet_test
No matter how often I authorize this, $this->loggedin() never triggers. Debug mode isn't helping as the cycle never rests on my app for very long and this oAuth login system you have in here is just a few too many functions for my pea-brain to comb through and figure out.
I'm sorry this isn't more helpful in helping to determine my own solution - but I'm at the point of giving up after three hours and I'm hoping someone else can shed some light on this before I give up entirely.
Thanks.
I am not sure why this is not working:
public function authenticate() {
if ( !$this->tweet->logged_in() )
{
// not logged in twitter - send off for login
$this->tweet->set_callback(site_url('home'));
$this->tweet->login();
}else {
// logged in twitter - get user data
$u=$this->twitter_model->getuserData() ;
$data=array(
'user' => $u,
'logged_in' => true
);
$this->session->set_userdata($data) ;
redirect('home') ;
}
$u=$this->twitter_model->getuserData() ;
$data=array(
'user' => $u,
'logged_in' => true
);
$this->session->set_userdata($data) ;
}
This is getuserData() :
public function getuserData() {
$tokens = $this->tweet->get_tokens();
$user = $this->tweet->call('get', 'account/verify_credentials');
$username = $user -> screen_name ;
return $username ;
}
Hello,
I'm using your library in a project and I've run into a little problem when calling "account/rate_limit_status" It turns out that you do not use the API version in the API URL and it gives erroneous results in the sense that even when the user is authenticated the rate limit is 150 hits per hour when it should be 350. I fixed it by changing line 285 from private $_apiUrl = 'http://api.twitter.com'; to private $_apiUrl = 'http://api.twitter.com/1'; and it works as intended.
Check out this thread for more clarification: http://groups.google.com/group/twitter-development-talk/browse_thread/thread/761a75fbd261f9ed#
impeto
Hi Elliot,
I am trying out this library but have run into an issue.
What I did:
-I dropped the files into a fresh CI reactor install,
-I entered my consumer info into the config/tweet_config.php file
-I went to the tweet_test url,
-it sent me to twitter to authenticate but it had an error page that the tokens were already used,
-I noticed that there was no value for the oauth_token parameter in the querystring,
-I dug into the code and tried to find why there was no oauth_token being received,
-I tracked the code to where the response comes back from twitter, line 205 of /libraries/tweet.php,
-I put this line in before it die(var_dump($response));
-After re running the request I get the dump of a tweetResponseOauth object that has a 401 error code and this message "Failed to validate oauth signature and token"
I hit google looking for help and turned up nothing except that it could be the server time not accurate enough, I checked the server time and it is accurate.
I am at a loss to figure out the problem and it happens on both my home server and my production server, any assistance would be appreciated.
-Luke
UPDATE: Alright, after a few days away from the code, I came back to try again. I figured out the problem pretty much straight away... I skipped a step in the installation instructions, so this is all my bad, sorry.
To have your application register with twitter as a browser app you MUST supply a callback url, failure to enter will will revert your selection to a client app and will cause the error I got.
My apologies to anyone who might have looked into this and I promise that next time I will RTFM... properly :P
How do I tweet from CI using this ?
I'm not quite sure if I was doing something wrong or what, but when attempting some of the REST API calls, I was getting 404'd and had no idea why.
I believe the problem comes from the Tweets library file and that the _apiUrl that is formed isn't valid. If you look at the formation, it appears to be missing that ../1/.. from the URL string. I cheated it by changing line 322 to look like:
$response = $this->_httpRequest(strtoupper($method), $this->_apiUrl.'/'.$this->_version[0].'/'.$path.'.json', $args);
And it fixed it up for me. Haven't run into any errors, even when using various API GETs that weren't giving me errors before the change.
in my project i make twitter and facebook auto loaded
and i work on another lib to get google contacts
when finish authorize step and google redirect to
http://site.com/google/auth?oauth_token=xxx&oauth_verifier=xxx
the problem here in tweetOauth::_checkLogin(), cous it loaded in construct without any flag check
i think we can make flag when goto to authorize, and when u find $_GET['oauth_token'] and the flag = 1, run tweetOauth::_checkLogin() to access ur token
Thanks Elliot
@HazemKhaled
Hey guys,
Just downloaded this library, followed all the instructions, but for some reason I am not able to successfully connect to twitter. Whenever I run the tweet_test example, an exception gets thrown at line 205 in tweet.php. Doing a var_dump, it seems like I am getting an error 401 - /oauth/access_token Invalid / expired Token .
So I ran a test, got a fresh codeiginiter install, and the plugin works. I think the issue lies with my mod_rewrite rules for making the url pretty.
These are the relevant settings in my config.php:
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
Relevant settings in my .htaccess:
RewriteCond $1 !^(index.php|stylesheets|scripts|images|robots.txt|favicon.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
I think the url rewrite is somehow causing this issue, any ideas on how to solve this?
Thanks!
hello, these are the errors I get when I use the library, I hope you can help me
Severity: Notice
Message: Trying to get property of non-object
Filename: libraries/Tweet.php
Line Number: 205
Severity: Notice
Message: Trying to get property of non-object
Filename: libraries/Tweet.php
Line Number: 478
Is anyone else getting a stack trace when updating the profile Image?
$avatar_response = $this->tweet->call('post', 'account/update_profile_image', array('@image' => '@{$loc}'));
I've tried other combinations, no at sign, /1 in the url, same problem. The only thing I learned was that in this call, the image needs to be a raw multi-part file. Is that something this library supports?
Thanks
I tried a number of different encodings but but kept getting 'incorrect signature'. In the end I though I should mention it because the library should be able to handle it. I love the library it is working great but I am just utilizing the post functionality, thanks.
I found this very bizzare. What is included in tweet_test is:
$this->tweet->call('post', 'friendships/create', array('screen_name' => $user->screen_name, 'follow' => TRUE));
This returns an error that you can't follow yourself.
The code should be:
$this->tweet->call('post', 'friendships/create', array('screen_name' => 'elliothaughin', 'follow' => TRUE));
From what I undertand, some API calls like users/show and statuses/user_timeline do not require authentication. So how do I make these calls using Elliot's Twtter library without authenticating?
For example when I try to do this (before authenticating) an exception will be thrown.
$user = $this->tweet->call('get', 'users/show', array('screen_name' => 'somescreenname'));
Sorry if this is a dumb question.
So I'm stating the obvious here, as the Twitter API sends crucial information via GET
However, CI (famously) destroys the $_GET array and it can't be used.
I've spoken to some great developers that say they drop this in and it works great. How in the world is this possible?
I'm on the other side of this, and $_GET isn't working for me.
Is there a trick to this? A setting somewhere? Some kind of magic spell?
I'm practically beside myself trying to get this figured out.
Thanks in advance
Hello,
I keep getting these errors no matter what.
I get redirected to twitter fine, login, and twitter redirects back to my call-back url with something like this:
Now on this url I get the following error, the error is almost impossible for me to decipher, I have also enabled debugging but I can't get any more info, help please. Is this a BUG???
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: libraries/tweet.php
Line Number: 205
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: libraries/tweet.php
Line Number: 205
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: libraries/tweet.php
Line Number: 370
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /hermes/bosweb25c/b1454/d5.alihamza/public_html/loop/system/core/Exceptions.php:170)
Filename: helpers/url_helper.php
Line Number: 543
Hi,
Since january's Twitter Update, I can't use codeigniter-twitter library anymore, is anybody have an idea ? I have made a few modifications to support SSL and new urls:
https://www.dropbox.com/s/wp3uiifahd9os08/Capture%20d%27%C3%A9cran%202014-02-02%2018.49.31.png
https://www.dropbox.com/s/73gfe7xthhrnzvw/Capture%20d%27%C3%A9cran%202014-02-02%2018.50.19.png
Thanks,
Whenever I try this:
$friends = $this->tweet->call('get', 'friends/ids', array('screen_name' => $user->screen_name));
I get errors:
Severity: Notice
Message: Undefined property: stdClass::$request
Filename: libraries/tweet.php
Line Number: 205
AND
Severity: Notice
Message: Undefined property: stdClass::$error
Filename: libraries/tweet.php
Line Number: 205
The call returns 'false'. What is going on here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.