Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need to fetch facebook likes,share, comments count from an article

Is there any way to fetch facebook (likes,share, comments) count.

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
228 views
Welcome To Ask or Share your Answers For Others

1 Answer

Actually you can have a more detailed report using FQL. Try following query:

  • SELECT url, normalized_url, share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url = 'www.apple.com'

Here the php code:

$fql  = "SELECT url, normalized_url, share_count, like_count, comment_count, ";
$fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM ";
$fql .= "link_stat WHERE url = 'www.apple.com'";

$apifql="https://api.facebook.com/method/fql.query?format=json&query=".urlencode($fql);
$json=file_get_contents($apifql);
print_r( json_decode($json));

And this is the expected result:

Array
(
    [0] => stdClass Object
        (
            [url] => www.apple.com
            [normalized_url] => http://www.apple.com/
            [share_count] => 355693
            [like_count] => 500374
            [comment_count] => 290890
            [total_count] => 1146957
            [commentsbox_count] => 2
            [comments_fbid] => 388265801869
            [click_count] => 16558
        )

)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...