如何从一篇文章中获取Facebook的喜好,分享,评论 [英] How to fetch facebook likes, share, comments count from an article

查看:104
本文介绍了如何从一篇文章中获取Facebook的喜好,分享,评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从文章中获取Facebook的喜欢,分享,评论数量

有什么办法来取得Facebook(喜欢,分享,评论)计数



提前感谢

解决方案

您可以使用FQL更详细的报告。
尝试以下查询:




  • 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'



这里是PHP代码:

  $ 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));

这是预期的结果:

 数组

[0] => stdClass对象

[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




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.

解决方案

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
        )

)

这篇关于如何从一篇文章中获取Facebook的喜好,分享,评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆