How do I show latest tweet on my site using 1.1 Api?


#1

I used the tutorial over at Stack Overflow titled ‘So you want to use the Twitter v1.1 API?’ - it’s here: http://stackoverflow.com/questions/12916539/simplest-php-example-retrieving-user-timeline-with-twitter-api-version-1-1

The tutorial was good for helping me set up a twitter dev account but doesn’t show me how to display the information it finds. For example it can GET a list of followers, but it just echoes a bunch of user ids on the page. I need help getting the latest tweet, and know wing what to do with the information the Twitter api sends me.

Sorry if this is really basic. Thanks for your time!


#2

oh ~ nobody knows?


#3

:slight_smile: it seems nobody wants te share?! :wink: or they also do not know?!


#4

I am having the same problem and cannot find any answers.


#5

It is nuts. Can’t believe this is so difficult.


#6

me too, Only want the last tweet


#7

Oh you can show your latest tweet with the
data-tweet-limit="1"
parameter added to your widget timeline, but it won’t auto-update. So all they
will see was the latest tweet when the page was loaded.
You could auto-refresh the page but this may get you flagged
by Symantec.


#8

For everyone wanting to solve this using 1.1, head over to webdevdoor.com. He’s got it working using the setup discussed here:

http://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/

And you can format the appearance of the JSON response (and limit the number of tweets if you only want to show the last tweet) by following the guidelines here:
http://www.webdevdoor.com/javascript-ajax/custom-twitter-feed-integration-jquery/

Thanks so much, Tom E.!


#9

here’s how i got it working:

set up a new app for this client/site and then get the keys
// Your Twitter App Consumer Key
private $consumer_key = ‘XXXXXXXXXX’;

// Your Twitter App Consumer Secret
private $consumer_secret = 'XXXXXXXXXX';

// Your Twitter App Access Token
private $user_token = 'XXXXXXXXXX';

// Your Twitter App Access Token Secret
private $user_secret = 'XXXXXXXXXX';

i used the tweet.js mod here: https://github.com/StanScates/Tweet.js-Mod

drop your tokens into the index.php inside the /twitter/ folder.
** you’ll need to update the modpath to reflect where the feed is being shown **

it’s a little fiddly, but it works.

good luck!


#10

Great libs. I tryed that and it’s working very well!
Thanks


#11

Thanks man!


#12

How get the tweets for specific date using getUserTimeLIne()

plzzzz help


#13

Plz tell me tell step by step. I am not getting.
Thanks in advance


#14

Something like this will work if you have a PHP Twitter oAuth lib. It will show the latest 3 tweets. See the API documentation to optimize it further: https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

$tweets = $connection->get('statuses/user_timeline', array('screen_name' => USERNAME, 'count' => '3' )); foreach ($tweets as $tweet) { echo "
".$tweet->text.""; }

#15

#16