I've got a site with lots of news, however i'm wondering if there is any way i can sort my articles by facebook likes? and how can i do this without killing my server by updating all articles x times in a day?

2 Answers
2

Create a db table to hold the facebook likes (URL, Likes, Timestamp). Upon page load, if Timestamp > now + a certain amount of time, refresh the Likes in the table. The data could be slightly out of date, but if you had a refresh time of 5-10 minutes, I would think it would be pretty close most of the time.

Well first of all you should drop the old REST interface and switch to the Graph API.

When you do that you'll be able to get data for more than one object in a single request, by specifying a comma separated list of the URLs you want. You can do this both from PHP with a simple GET, or via Javascript with a call to FB.api().