如何获得Facebook Page Likes的总数

时间:2018-05-07 12:58:08

标签: php facebook facebook-graph-api

我是Facebook Graph API v3的新手。如果你们知道最简单的方法,可以非常感谢页面总数。

TIA!

1 个答案:

答案 0 :(得分:1)

使用相关网页的网页访问令牌,向me/insights?metric=page_fans发出GET请求。

结果输出将沿着这些行:

{
  "data": [
    {
      "name": "page_fans",
      "period": "lifetime",
      "values": [
        {
          "value": 36,
          "end_time": "2018-05-04T07:00:00+0000"
        },
        {
          "value": 36,
          "end_time": "2018-05-05T07:00:00+0000"
        }
      ],
      "title": "Lifetime Total Likes",
      "description": "Lifetime: The total number of people who have liked your Page. (Unique Users)",
      "id": ".../insights/page_fans/lifetime"
    }
  ],
  "paging": {
    "previous": "...",
    "next": "..."
  }
}

如果页面不在您的控制范围内(因此,您无法获取页面标记),则可以向页面发出一个fields=fan_count的GET请求,即/Google?fields=fan_count。结果输出如下:

{
  "fan_count": 26034652,
  "id": "104958162837"
}