How would I go about combining multiple users twitter feeds into one list a开发者_如何学Gond display them on my page?
You'd have to go in, I'd say, three steps :
- Get the feed of each one of the users
- Those are available as RSS feeds ; for example : http://twitter.com/statuses/user_timeline/17907318.rss
- This means you can download it with
curl
, or download+read it withsimplexml_load_file
.
- 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
- You'll have to merge those into a single array, containing all the feeds of all users ; see
- 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
精彩评论