Combine multiple twitter feeds into one list with

2019-04-15 03:03发布

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

标签: php twitter
1条回答
ら.Afraid
2楼-- · 2019-04-15 03:34

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
查看更多
登录 后发表回答