0

How can I simple get count of likes, shares and comments from a URL using PHP?

The method using FQL or graph.facebook.com didnt work anymore.

I need also about 1000 requests per day, I need solution with request limit more then 1000.

adminko
  • 73
  • 1
  • 7

1 Answers1

2

I think that FQL became deceprated by the beginning of August. I've solved this problem using graph API and stating the fields argument

fields=likes.limit(0).summary(true),comments.limit(0).summary(true)

the fields likes and comments would give you a list of people who liked or commented on it, the .limit(0) means that you don't need any exact names mentioned and .summary(true) gives you more detailed info on it - the number of likes/comments.

I hope this explanation helps, you can find more info here https://developers.facebook.com/tools/explorer

Gillian
  • 202
  • 2
  • 9
  • 1
    Great, thank you very much! – adminko Aug 21 '16 at 14:08
  • You're welcome ^^ took me some time to find this too. Graph API could be a little better documented. – Gillian Aug 21 '16 at 14:10
  • 1
    You mean something like this: `http://graph.facebook.com/?fields=share,og_object{likes.limit(0).summary(true),comments.limit(0).summary(true)}&id=http://www.rio2016.com`? Because i see 0 likes and 1 comment... – adminko Aug 21 '16 at 14:29
  • the correct `id` is `&id=http://www.rio2016.com` – adminko Aug 21 '16 at 14:33
  • 1
    using this method you can only get about 20 requests (after 20 is request limit reached) – adminko Aug 23 '16 at 08:31
  • What are you talking about? Using this method you will get the full like count and the full comment count in one request. Also you can do with your app up to 2400 requests per user per day, how can you have a limit of 20? – Gillian Aug 24 '16 at 15:21
  • @Gillian he's likely not authenticating his request with an app token. The endpoint is accessible without it, but the rate limit is much lower. – cafonso Aug 31 '16 at 14:18
  • @Gillian Could you update your answer with the correct example like how@adminko mentioned?. If I copy paste your example, it doesn't work. The one below worked, but am not happy with the results. https://graph.facebook.com/?fields=id,share,og_object{likes.limit(0).summary(true),comments.limit(0).summary(true)}&id=http://www.rio2016.com Please note that the Share_Count seems to be the engagement count and the Like Count doesn't always show up, have also tried the same by passing the accesstoken. – Krishnan Venkiteswaran Jan 30 '17 at 07:07