Download .zip |
Info | Example | View files (3) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2017-03-18 (1 month ago) | Not enough user ratings | Total: 30 This week: 1 | All time: 8,842 This week: 743 |
Version | License | PHP version | Categories | |||
twitterfeed 0.3 | GNU Lesser Genera... | 5 | PHP 5, Web services, Social Networking |
Description | Author | |
This class can retrieve the tweets from a user timeline. |
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: https://dev.twitter.com/oauth/application-only https://dev.twitter.com/rest/reference/get/statuses/user_timeline 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 https://api.twitter.com/oauth2/token - make a GET request to Twitter API using the access token; you can use any valid endpoint, I'm using https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=[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 = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=[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 |
File | Role | Description |
---|---|---|
example.php | Example | example |
GetTwitterFeed.class.php | Class | Main class |
README | Doc. | Some instructions |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.