Thursday, October 18, 2012

How to get a FaceBook comment count for a page?

Face open graph api has relevant info, to send you the facebook comment count for a particular page. Below is the sample code, which will return you the JSON response of the page details, from where you can fetch comments count, you just need to pass the URL.

Note: Your page URL is the unique identifier.

$json = json_decode(file_get_contents('' . $url));
return ($json->$url->comments) ? $json->$url->comments : 0;


  1. Thanks Ramanujam. This helped me to resolve/clarify a production issue

  2. Its me, MY AOL name isn't 999999********