列出最喜欢的帖子

时间:2016-08-01 19:34:00

标签: php facebook facebook-graph-api facebook-php-sdk

使用Graph Explorer API调用以下内容:

me?fields=posts{likes.summary(true).filter(stream).order(ranked)}

我收到我的帖子,谁喜欢包含总数的摘要:

{
    "posts": {
        "data": [{
            "id": "xxxxxxxxxxxxxxxxxxx",
            "likes": {
                "data": [{
                    "id": "xxxxxxxxxxxxxxxxxxx",
                    "name": "xxxxxxxxxxxxxxxxxxx"
                }],
                "paging": {
                    "cursors": {
                        "before": "...",
                        "after": "..."
                    },
                    "next": "..."
                },
                "summary": {
                    "total_count": 35,
                    "can_like": true,
                    "has_liked": false
                }
            }
        }, {
            "id": "zzzzzzzzzzzzzz",
            "likes": {
                "data": [{
                    "id": "zzzzzzzzzzzzzz",
                    "name": "zzzzzzzzzzzzzz"
                }],
                "paging": {
                    "cursors": {
                        "before": "...",
                        "after": "..."
                    },
                    "next": "..."
                },
                "summary": {
                    "total_count": 30,
                    "can_like": true,
                    "has_liked": false
                }
            }
        }]
    }
}

通过这种方式,他给我带来了每个帖子的赞。如何列出更喜欢的帖子?

1 个答案:

答案 0 :(得分:0)

很抱歉这个简短但有点令人不快的答案,但是...没有办法用API做到这一点。您需要收集结果并在PHP脚本中手动订购。