Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter API to get recent tweets of a particular user

Tags:

twitter

Which API would I need to use to get 'n' recent tweets of a particular user with a public account?

like image 866
user330973 Avatar asked Nov 11 '10 09:11

user330973


People also ask

How do I Download tweets from Twitter API?

Navigate to your app dashboard. Select the app you've enabled with the Tweets and users preview, then click Details. Select the Keys and tokens tab. In the Consumer API Keys section, copy the values for API Key into consumer_key and API Secret Key into consumer_secret .


2 Answers

To get tweets from a specific user you will want to use the GET statuses/user_timeline API method.

like image 166
abraham Avatar answered Sep 22 '22 05:09

abraham


As of May 7th, 2013, Twitter's already deprecated v1.0 is being retired and v1.1 is the only method of accessing the API, using authenticated requests via OAuth.

v1.0 deprecated

This means you won't be able to use PHP's file_get_contents() entirely on it's own to grab this sort of thing - you need to write a script that utilises OAuth and Twitters v1.1 API.

I recently wrote a Stack Overflow answer to help out newbies to the twitter v1.1 API, and I wrote a class to make this easier for you.

You need to create a developer account, grab yourself a set of developer keys to use within your application, and make authenticated requests using OAuth. If you read the post above, you'll see I created a simple class to allow you to do this.

TLDR: Can't use v1.0 any more, use 1.1 and this class for simplicity: https://github.com/J7mbo/twitter-api-php

like image 40
Jimbo Avatar answered Sep 22 '22 05:09

Jimbo