How to get facebook share, like, comment count for a url with graph api only (in a non-deprecated way)

前端 未结 6 1060
[愿得一人]
[愿得一人] 2020-12-14 10:52

The problem is that after v2.1 of graph api fql will be deprecated.

Can someone tell me how to get separate likes, share count for given url using only graph api? I

6条回答
  •  佛祖请我去吃肉
    2020-12-14 11:29

    You can use facebook graph api like https://graph.facebook.com/?ids=http://mycodingtricks.com and it will return a json code like

    {  
        "http://mycodingtricks.com":{  
            "id":"http://mycodingtricks.com",
            "shares":1
        }
    }
    

    I have developed my own php script on which you can all social count using that api. http://mycodingtricks.com/share/social.php?url=YOUR-URL-HERE and it will return data like:

    {  
        "facebook":[  
            {  
                "share_count":1,
                "like_count":0,
                "comment_count":0,
                "total_count":1,
                "click_count":0,
                "comments_fbid":567687199998199,
                "commentsbox_count":0
            }
        ],
        "googleplus":10,
        "twitter":3,
        "buffer":0,
        "pinterest":0,
        "stumblupon":1,
        "reddit":"

    403 Forbidden<\/h1>\nRequest forbidden by administrative rules.\n<\/body><\/html>\n", "linkedin":0 }

    But if you wants to use on your own Here is a complete article about how to count facebook share,like and all. http://mycodingtricks.com/php/2-ways-to-count-facebook-likes-shares-and-comments-using-php/

提交回复
热议问题