Skip to content Skip to sidebar Skip to footer

How To Get Facebook Share Count And Comment Count On Version 2.7

What is my Issued? Im not getting result/output, using my php code?(first issued) How to input my Access Token on my php code? (Second Issued) When i enter this URL from browser: h

Solution 1:

I found a solution, but not in php ruther is js

Here is the working Code:

$(function() {
      var url = "http://facebook.com";
      var apiUrl = "https://graph.facebook.com/?ids=" + url;
    
  $.ajax({
      url: apiUrl,
      success: function(result) {
  $.each(result, function(key, val) {
        console.log(key + " - " + val["share"]["share_count"]);
        console.log(key + " - " + val["share"]["comment_count"]);

            var commentCount = val["share"]["comment_count"];
            var shareCount = val["share"]["share_count"];
            $("#fb-like-div").html(shareCount);
            $("#fb-comment-div").html(commentCount);
          });
        }
      });
    });
#fb-like-div,#fb-comment-div{color:red;}
<scripttype="text/javascript"src="//code.jquery.com/jquery-1.12.4.js"></script><divid="fb-like-div">0</div><divid="fb-comment-div">0</div>

Post a Comment for "How To Get Facebook Share Count And Comment Count On Version 2.7"