I am trying to get total page likes using following method
$response = $fb->get('/{page_id}/insights/page_fans', $_SESSION['fb_access_token']);
$data = $response->getDecodedBody();
but i am getting output like
{
"data": [
{
"name": "page_fans",
"period": "lifetime",
"values": [
{
"value": 4950,
"end_time": "2016-06-04T07:00:00+0000"
},
{
"value": 4951,
"end_time": "2016-06-05T07:00:00+0000"
},
{
"value": 4954,
"end_time": "2016-06-06T07:00:00+0000"
}
],
"title": "Lifetime Total Likes",
"description": "Lifetime: The total number of people who have liked your Page. (Unique Users)",
"id": "5440223423423f216075/insights/page_fans/lifetime"
}
],
"paging": {
"previous": "https://graph.facebook.com/v2.6/123/insights/page_fans?access_token=EAACEdEose0cBAPZCXGPTTelvenkGYIwiZAbT4N26ZB97KwDvbi9TfoyvkeET8WLiSbVHS7k3FsQL5w5DFJK5mAus0XA1123TPaPBEpxhdUq123ZAx1r7B3wIVjJVjLk2jrVu1M8apfBndmz9FUviAzWRpR4vHRgBYcSxEn4JXcioASljYLwZDZD&debug=all&format=json&method=get&pretty=0&suppress_http_code=1&since=1464617613&until=1464876813",
"next": "https://graph.facebook.com/v2.6/123/insights/page_fans?access_token=EAACEdEosDe0cBAPZCXG123PTTelvenkGYIwiZAbT4N26ZB97KwDvbi9TfoyvkeET8WLiSbVHS7k3FsQL5w5JK5mAus0XATPaPBEpxhdUqZAx1r7B3wIVjJVjLk2jrVu1M8apfBndmz9FUviAzWRpR4vHRgBYcSxEn4JXcioASljYLwZDZD&debug=all&format=json&method=get&pretty=0&suppress_http_code=1&since=1465136013&until=1465395213"
}
}
but i need total likes of pages.how can we do this
old way using FQL - select fan_count from page where page_id = page_id;
but i am trying using latest api v2.6
[from comments] i need total page likes which is showing on facebook page
Well then you should not have been using the insights
edge to begin with, but just
/page-id?fields=fan_count