PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 26, 2022

[FIXED] How to get likes count from facebook graph api which is shared from my web app?

 February 26, 2022     facebook, facebook-graph-api, facebook-php-sdk     No comments   

Issue

I am able to get share count and comments count but unable to get the likes count. https://graph.facebook.com/?ids=MY_URL this API gives the response as,

{
  "MY_URL": {
     "share": {
        "comment_count": 0,
        "share_count": 13,
     },
     "id": "MY_URL",
  }
}

In the same way, I just need to get likes count/ reaction count from API. Please help. Thanks in Advance


Solution

Check out the engagement field - https://developers.facebook.com/docs/graph-api/reference/v3.2/url

It returns four different counters - comment_count, comment_plugin_count, reaction_count and share_count.

The reaction_count would be the number of all reactions (like, love, sad, …) - that is as much “detail” as you can get in this regard for external Open Graph objects.

Example in Graph API Explorer, for the object http://example.com/:

https://developers.facebook.com/tools/explorer?method=GET&path=%3Fids%3Dhttp%253A%252F%252Fexample.com%252F%26fields%3Dengagement&version=v3.2



Answered By - 04FS
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing