SimpleTwitter: small PHP class for search on Twitter

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

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

Related posts

  1. My Social Media Detox, part 3: Twitter account
  2. How to check Cloudflare cache status programmatically
  3. A Telegram Echo Bot built with a single PHP line