Get facebook posts and total count of likes for each post

点点圈 提交于 2020-01-03 09:09:04

问题


I am trying to get a Facebook page posts with count of comments and likes for each post.

For likes there is a parameters I can pass which is summary = true and total_count . I tried this

page_id?fields=posts.limit(1).summary(1)

but nothing comes back.

I can not write FQL as it will be deprecated soon. I am writing php API.


回答1:


You can get total count by passing arguments like

?fields=likes.summary(1),comments.summary(1),

$fbtimeposts = (new FacebookRequest($session, 'GET', "/me/feed?fields=likes.summary(1),comments.summary(1),story,link,comments,likes,source,picture,type,status_type,application,message,message_tags,name,caption,actions,from,feed_targeting,full_picture,description,updated_time,created_time,id,object_id,parent_id,place,story_tags,targeting,with_tags&limit=10&date_format=U&limit=10&date_format=U"))->execute()->getGraphObject()->asArray();  

I hope above example helps you in someway!!!!




回答2:


You can try this

?fields=likes.limit(0).summary(1),comments.limit(0).summary(1)

?fields=likes.limit(0).summary(true),comments.limit(0).summary(true)


来源:https://stackoverflow.com/questions/28805968/get-facebook-posts-and-total-count-of-likes-for-each-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!