PHP Classes

PHP Twitter Timeline Feed: Retrieve the tweets from a user timeline

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 173 All time: 8,800 This week: 524Up
Version License PHP version Categories
twitterfeed 0.3GNU Lesser Genera...5PHP 5, Web services, Social Networking


This class can retrieve the tweets from a user timeline.

It can obtain a OAuth token to send API calls to Twitter and sends a HTTP request to retrieve a given user tweets.

The class returns the response tweets as a JSON string.

Picture of andrea bernardi
  Performance   Level  
Name: andrea bernardi <contact>
Classes: 3 packages by
Country: Italy Italy
Age: 47
All time rank: 2609101 in Italy Italy
Week rank: 276 Up15 in Italy Italy Up
Innovation award
Innovation award
Nominee: 1x



header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');

$retrieveUrl = "[TWITTER_USERNAME]";
$consumer_key = "";
$consumer_key_secret = "";
$objTwitter = new GetTwitterFeed($retrieveUrl, $consumer_key, $consumer_key_secret);


README I've written this class to automate the process of authenticating and querying the Twitter APIs. There are three steps to follow, the first is up to you: - create a client on Twitter Dev site, just follow the instructions here: The second and third steps are accomplished by my class and are: - make a POST request to Twitter Oauth service in order to retrieve an access token; the endpoint is - make a GET request to Twitter API using the access token; you can use any valid endpoint, I'm using[TWITTER_USERNAME] That GET request, if correct, returns the json with the feed of the Twitter user passed through screen_name GET variable. EXAMPLE After creating a client on Twitter Dev site, you have to use consumer_key and consumer_key_secret provided by the client: $consumer_key = "CONSUMER_KEY"; $consumer_key_secret = "CONSUMER_KEY_SECRET"; Then create an instance of GetTwitterFeed; the first parameter is the endpoint: $retrieveUrl = "[TWITTER_USERNAME]"; The second and third parameters are consumer_key and consumer_key_secret $objTwitter = new GetTwitterFeed($retrieveUrl, $consumer_key, $consumer_key_secret); If you want to print the raw json, remember to declare correct headers: header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); echo $objTwitter->getJsonFeed();

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example
Plain text file GetTwitterFeed.class.php Class Main class
Accessible without login Plain text file README Doc. Some instructions

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,800
This week:524Up