php - How to get all post from a page with count ALL likes and comments? -
attached got question ... try feeds likes , comments retrieve page during period. or .. need total number of likes , comments overall.
so far ...
$user_pages = $facebook-> api ('/ me / accounts'); ... $page_feeds = $facebook-> api ("/". $ page_name ['id']. '/ feed', 'get', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("y")))); ... foreach ($page_feeds ['data'] $ page) { $c = $facebook-> api ("/" $ page ['id'] "/ likes", "get", array ('limit' => 10000)..); $temp ['likes'] = count ($ c ['data']); $c = $ facebook-> api ("/" $ page ['id'] "/ comments", "get", array ('limit' => 10000)..); $temp ['comments'] = count ($ c ['data']); } .....
so pages in admin, feeds page since first of month. has been going on forever until answer there. problem max 25 max 25 likes , comments. (the word "counts" described in api documentation missing here.
so have call in loop every feed likes , comments on , number.
these queries take 3 minutes ... long ...
is not ne nice way? have been able find anything. hoping query
$page_feeds = $ facebook-> api ("/". $ page_name ['id']. '/ feed', 'get', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("y"))));
can adjust, , likes , comments (or @ least numbers) get
150769909716/feed?fields=likes.limit(10000).fields(id),comments.limit(10000).fields(id)&limit=10000&since=1372608000
unfortunately gives me maximum of 25 likes , comments.
timo
#edit:
https://graph.facebook.com/[pageid]/feed?fields=likes.limit%2810000%29.fields%28id%29,comments.limit%2810000%29.fields%28id%29&locale=de_de&since=1372608000&limit=10000&access_token=yyyy
give me:
{ "data": [ { "id": "xxx_xxx", "created_time": "2013-07-23t07:08:25+0000", "likes": { "data": [ { "id": "xxxx" }, ], "paging": { "cursors": { "after": "xxx", "before": "xxxx" }, "next": "xxxx" } }, https://graph.facebook.com/[pageid]/feed?since=1372608000&limit=10000&access_token=yyyy
giv me: (yes, count there...but browsercall)
"likes": { "data": [ { "name": "xxx", "id": "xxx" }, ], **"count": 53** },
the same call per call give me result without count data....
unfortunately facebook has removed have seen total count of likes , comments when @ posts. instead need make call each post retrieve total likes or comments. have renamed count total_count
example:
for likes
https://graph.facebook.com/post_id/likes/?summary=true
it return this
{ "data": [ { "id": "xxxx", "name": "xxxxx" }, { "id": "xxxx", "name": "xxxxx" }, { "id": "xxxx", "name": "xxxxx" }, { "id": "xxxx", "name": "xxxxx" } ], "paging": { "cursors": { "after": "ntu2mtu3nju0", "before": "mta4otm4nzgwma==" } }, "summary": { "total_count": 4 } }
for comments:
https://graph.facebook.com/post_id/comments/?summary=true
{ "data": [ { "id": "xxxxx", "from": { "category": "media/news/publishing", "category_list": [ { "id": "xxxxxx", "name": "xxxx" }, { "id": "xxxxxx", "name": "xxxx" } ], "name": "xxxxx", "id": "xxxxx" }, "message": "xxxxxxx", "can_remove": false, "created_time": "2013-07-03t20:36:54+0000", "like_count": 0, "user_likes": false } ], "paging": { "cursors": { "after": "mg==", "before": "mg==" } }, "summary": { "order": "ranked", "total_count": 2 } }
Comments
Post a Comment