Often i publish some small code snippets, usually written during development of large projects.
Today i want to share a small PHP class that uses Twitter API in order to perform a search and downloads the most recents tweets.

In order to use this class, you need to create a new Twitter app at this link https://apps.twitter.com/app/new.

Once the registration is complete, you could obtain API key and Access token from the "Keys and Access Tokens" in your app Dashboard.

Finally, you can instantiate and use the class in this way:

$twitterclass = new SimpleTwitter($oauth_access_token, $oauth_access_token_secret, $consumer_key, $consumer_secret);
print_r ($twitterclass->query("Keywords","EN"));

The query method returns a PHP array obtained from the json output of Twitter API.


References and download