获取Facebook的帖子和每个帖子的总计数 [英] Get facebook posts and total count of likes for each post

查看:167
本文介绍了获取Facebook的帖子和每个帖子的总计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获得一个fb页面的帖子,其中包含每个帖子的评论和喜好。



对于喜欢,我可以传递一个参数,即 summary = true total_count
我试过这个
page_id?fields = posts.limit(1).summary(1),但没有回来。
我不能写FQL,因为它将很快被削减。我正在写php API。



提前感谢。



答案: / p>

page_id?fields = posts.limit(40){likes.limit(1).summary(1),comments.limit(1).summary(1)}



因为我不需要任何意见,只是总结我设置comments.limit(1),相同的喜欢。



感谢您的帮助!

解决方案

您可以通过传递参数(如


)获得总计数

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

$ fbtimeposts =(new FacebookRequest ,'GET',/me/feed?fields=likes.summary(1),comments.summary(1),story,link,comments,likes,source,picture,type,status_type,application,message,message_tags,name ,字幕,动作,从,feed_targeting,full_picture介绍updated_time,CREATED_TIME,ID,的object_id,PARENT_ID,地点,story_tags,定位with_tags&安培;限制= 10安培; DATE_FORMAT = U&安培;限制= 10安培; DATE_FORMAT = U)) - >执行() - > getGraphObject() - > asArray();

我希望上面的例子可以帮助你在某个地方!!!!


I am trying to get a fb 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 depricated soon. I am writing php API.

Thanks in advance.

Answer :

page_id?fields=posts.limit(40){likes.limit(1).summary(1),comments.limit(1).summary(1)}

Because I don't need any comments but only summary I set comments.limit(1), same for likes.

Thanks for your help!

解决方案

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!!!!

这篇关于获取Facebook的帖子和每个帖子的总计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆