Twitter none oAuth request with Haughin library |
[eluser]SteRiley[/eluser]
I'm trying to use Elliot Haughin's Twitter library to make a request to the Twitter API that does not require oAuth as the information I'm after is just on a public timeline as explained here: http://dev.twitter.com/doc/get/statuses/user_timeline I was hoping I could just do the following: Code: $user = $this->tweet->call('get', 'statuses/user_timeline', array('screen_name' => 'SteRiley')); This however just causes an error when debug is enabled. I thought this would bypass the oAuth request but it seems that is not so, what is it I'm doing wrong? Just some further information... for the end result, I basically want to display the last tweet that I made on my site. However I obviously don't want to authenticate via twitter each time. I may be missing the point of this whole oAuth thing here... do I need to store an oAuth token in my app so that it authenticates automatically without me clicking the YES log in button on the Twitter site.
[eluser]SteRiley[/eluser]
Ok I think I might have my head around this one now... I made a request to my app on twitter.com, I used the following to return my oAuth tokens: Code: $tokens = $this->tweet->get_tokens(); I've now saved these tokens into my app, which I hope will now do the trick, the final code should look like this. Code: $tokens = array( 'oauth_token' => 'MY_OAUTH_TOKEN', 'oauth_token_secret' => 'MY_SECRET_TOKEN' ); Can anyone confirm I've gone about this the right way?
[eluser]w0bbes[/eluser]
Im trying to do exactly the same... Let me know if you get it to work. Thanks
[eluser]SteRiley[/eluser]
If you read the second post I explain how its done. You just need to store the oauth_token and oauth_token_secret into your app, I think thats it then.
[eluser]SteRiley[/eluser]
How about when you do the following: Code: $tokens = $this->tweet->get_tokens(); Are you getting your tokens? This is what you'll need to embed into your application.
[eluser]w0bbes[/eluser]
Thanks for your reply. Yes, im getting my tokens when I var dump it, yet I still get <code>bool(false)</code> when I var dump the call
[eluser]SteRiley[/eluser]
Can you post the section of the code your having the problems with? I've used the following replacing MY_OAUTH_TOKEN & MY_SECRET_TOKEN with the ones dumped from gettokens: Code: $tokens = array( 'oauth_token' => 'MY_OAUTH_TOKEN', 'oauth_token_secret' => 'MY_SECRET_TOKEN' );
[eluser]w0bbes[/eluser]
**Sorry to bring this up again** I still havent fixed this, Here is how my controller looks Code: $this->load->library('tweet'); This will give me the following: Code: array(2) { ["oauth_token"]=> string(22) "MY_TOKEN" ["oauth_token_secret"]=> string(42) "MY_KEY" } Thanks in advance for any help you can give me
[eluser]w0bbes[/eluser]
PS.. when i run the tweet_test.php controller from Elliot's library, it outputs "hi there" When i try to make a call for the timeline in this test controller i get an exception: Quote:exception 'tweetException' with message '401 | Request Failed: /statuses/user_timeline.json?screen_name=briljantmartijn&count=1 - Invalid / expired Token' in /home/briljantm0/domains/briljantmedia.nl/public_html/system/application/libraries/tweet.php:205 |
Welcome Guest, Not a member yet? Register Sign In |