Skip to content

Latest commit

 

History

History
65 lines (42 loc) · 1.69 KB

File metadata and controls

65 lines (42 loc) · 1.69 KB

Custom-Twitter-PHP-API

Copyright (C) 2013 Robin Bonnes. All rights reserved.

Description

Due to deprecating Twitter API v1.0, developers need to create oAuth authentication to retrieve tweets. This script does exactly the same, without the OAuth hazzle, so its much easier to use. Its only less advanced as Twitter API v1.1. It will retrieve tweets (and retweets) with their avatar, username and post date in JSON format.

Live Demo

Check the demo here: http://www.robinbonnes.nl/projects/custom-twitter-api/demo.html

How to use

You have two options:

  1. Get tweets by username:

twitter_api.php?type=timeline&username=yourusername&count=5&retweets=true

  • username = Twitter username to retrieve tweets from.
  • count = Number of tweets to retrieve. Default: 5.
  • retweets = Boolean to enable/disable displaying retweets. Default: true.
  1. Get tweets by search keyword:

twitter_api.php?type=search&q=yourkeyword&count=5

  • q = Search keyword to retrieve tweets from.
  • count = Number of tweets to retrieve. Default: 5.

Output:

[{"username":"test","type":"tweet","avatar":"http://.../.png","date":"21 January 13","tweet":"Hello"}, {"username":"test2","type":"retweet","avatar":"http://.../.png","date":"23 January 13","tweet":"Hello"}]

License

The twitter_api.php is free to use everywhere ;-)

Changelog

  • v1.0 - Release
  • v1.1 - Search function added
  • v1.2 - Several bugfixes

Special Thanks

  • Apparent: Donator

======================

Note: PHP extension CURL is required.