如何从一篇文章中获取 Facebook 点赞、分享、评论数 [英] How to fetch facebook likes, share, comments count from an article
本文介绍了如何从一篇文章中获取 Facebook 点赞、分享、评论数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从一篇文章中获取 Facebook 点赞、分享、评论数
I need to fetch facebook likes,share, comments count from an article
有什么方法可以获取 Facebook(喜欢、分享、评论)计数.
提前致谢.
推荐答案
其实你可以使用 FQL 得到更详细的报告.尝试以下查询:
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'
这里是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));
这是预期的结果:
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屋!
查看全文