Snippet: Fetch Twitter Feed (With Retweets) in PHP
Here is a PHP that fetches a Twitter stream for a specified user. It also combines retweets with the regular updates. This puts them all in an array to make it easy to output them however you want.
This snippet uses APC to cache the data, but you can use any caching method such as memcached or database. It should be fairly easy to edit in your own caching.
Fetch Twitter Updates in PHP
Would you like to integrate Twitter into your website? In this tutorial, I'll explain how to access the Twitter API to fetch a user's updates using raw PHP (version 5.0 or greater). This will be a very basic use of the Twitter API, but it should give you a starting point if you need to do something more advanced. There are also some Twitter libraries that will let you do the same thing without knowing how it all works.
We will be utilizing the statuses/user_timeline method of the Twitter REST API. Basically, this is a special URL that returns the requested data in the requested format. In this case, we will request the user_timeline as XML, so our URL looks like: "http://twitter.com/statuses/user_timeline.xml?screen_name=username".
Follow us on Twitter
You can now follow UltraMega Tech on Twitter: http://twitter.com/UltraMegaTech
We'll keep you up to date on any projects we're working on as well as any useful information that we find. New blog posts will also be posted there.
