Which API would I need to use to get 'n' recent tweets of a particular user with a public account?
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 .
To get tweets from a specific user you will want to use the GET statuses/user_timeline API method.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With