Skip to content

Instantly share code, notes, and snippets.

@henrytran9x
Last active May 3, 2016 08:09
Show Gist options
  • Save henrytran9x/f232ec88946e5cca26a0 to your computer and use it in GitHub Desktop.
Save henrytran9x/f232ec88946e5cca26a0 to your computer and use it in GitHub Desktop.
This API facebook URL get comment count,share count , like count from Link ..this Render json string
<?php
public static function get_the_fb_like( $url = '' ){
$pageURL = 'http://nextopics.com';
$url = ($url == '' ) ? $pageURL : $url; // setting a value in $url variable
$params = 'SELECT comment_count, share_count, like_count FROM link_stat WHERE url = "'.$url.'"';
$component = urlencode($params);
$url = 'http://graph.facebook.com/fql?q='.$component;
$fbLIkeAndSahre = json_decode(file_get_contents($url));
$getFbStatus = $fbLIkeAndSahre->data['0'];
return $getFbStatus;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment