tags:

views:

406

answers:

2

Hi, How would I go about combining multiple users twitter feeds into one list and display them on my page?

+1  A: 

You'd have to go in, I'd say, three steps :

  • Get the feed of each one of the users
  • When you have downloaded the feed for each user, and parsed it, you have several arrays of feeds.
    • You'll have to merge those into a single array, containing all the feeds of all users ; see array_merge
    • And, then, probably sort that array by date ; see usort
  • And, finally, you'll have to display the resulting array, the way you want it.


As a sidenote : downloading several RSS feeds each time you want to display your resulting page is not a good idea : it will slow your site down a lot -- which means you need to put some caching mecanism in place :

  • either cache the tweets data ; for example, using a MySQL database
  • or cache the whole resulting portion of HTML code
Pascal MARTIN
+1 for caching. From memory, Twitter may also block your site/application if you retrieve the user feeds more than X number of times an hour (I think!)
richsage
A: 

You can also create a list of the accounts you are interested in and place a list widget on your page. No PHP needed.

http://help.twitter.com/entries/76460-how-to-use-twitter-lists

http://twitter.com/goodies/widget_list

abraham