获取一个Facebook的所有股份的列表 [英] Get a list of all the shares of a facebook post

查看:157
本文介绍了获取一个Facebook的所有股份的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用Facebook sdk获取评论列表,并且喜欢很好。但我不能
找到一种方式来获取共享一个帖子的所有用户的列表(我也尝试过fql)。

I can get a list of comments and likes just fine using the facebook sdk. But i can't find a way to get a list of all the users that shared a post (i tried fql as well).

这是我以前得到的代码:

This is the code i used to get the likes:

$facebook = new Facebook($config);

$likes = $facebook->api('/THE_POST_ID/likes',
    array('limit'=>9999999999));


推荐答案

撰写本文时,Facebook Graph API你得到一个职位的股份数。使用你的代码,它看起来像下面(请不要以为我没有做任何异常处理这里保持这个例子简单):

At the time of writing this, Facebook Graph API allows you to get the count of shares of a post. Using your code, it would look like the following (please not that I'm not doing any exception handling here for keeping the example simple):

$facebook = new Facebook($config);

// fetch the post data.
$post = $facebook->api('/THE_POST_ID/');

// fetch the count of shares.
$sharesCount = $post["shares"]["count"];

使用图形API资源管理器,您可以很容易地看到这一点。

Using the Graph API Explorer you can easily see that.

不幸的是,API不提供共享连接对于喜欢和评论。有关详细信息,请参阅 Post - Facebook Graph API文档

Unfortunately, the API does not provide a "shares" connection like it does for "likes" and "comments". See Post - Facebook Graph API Documentation for details.

另一方面,有一个肮脏的黑客可以检索共享一个特定帖子的用户列表(只有公开分享的朋友和人员)。解决方案在另一个线程上解释:在Facebook上分享的人员列表。但是,我永远不会建议使用该解决方案。

On the other hand, there is a dirty hack for retrieving the list of users (only friends and people who shared publicly) who shared a specific post. The solution is explained on another thread: List of people who shared on facebook. But, I would never suggest using that solution.

这篇关于获取一个Facebook的所有股份的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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