使用PHP检索Facebook页面状态 [英] Retrieving Facebook Page Statuses with PHP

查看:972
本文介绍了使用PHP检索Facebook页面状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网页上拖了几天,我找不到最新的工作方法来检索Facebook页面上的最新状态列表。

Having trawled the web for days, I cannot find an up-to-date, working method to retrieve a list of the latest statuses on a Facebook page.


  • 在Graph API的状态部分,我遇到了本文是指在Graph API v2.3之后删除的功能

  • 我可以我收到的file_get_contents在Facebook页面上工作,因为我提供了验证码。

这是竞争对手的研究,我只是想要:

It's for competitor research, I only actually want:


  • 发布日期

  • 喜欢/分享/回复次数

我不在乎状态内容本身,只是其周围的指标。

I couldn't care less for the status content itself, just the metrics around it.

一个JSON对象会很棒,但是在这个阶段我会采取任何行动。

A JSON object would be great, but I'll take anything at this stage.

任何人都设法获得这种数据,或者知道在Facebook页面上使用file_get_contents的方法?

Anyone else managed to get this sort of data or know a way to use file_get_contents on Facebook pages?

谢谢。

推荐答案

状态只是一个所以你需要做的只是请求页面的Feed帖子),然后检查他们的类型是否是状态。

A status is just a certain kind of post – so all you need to do is request the page’s feed (resp. posts) instead, and then check if their type is status.


我刚刚尝试访问帖子对象以获得喜欢/喜欢计数.etc并获取[message] =>(#12)单数状态版本v2.4及更高版本不推荐使用API​​

I've just tried to access the post object to get like/favourite counts .etc and get "[message] => (#12) singular statuses API is deprecated for versions v2.4 and higher"

您需要使用完整的帖子标识,从/ feed或/ posts端点获取它 - 页面ID,下划线,后置标识的组合。 (至少这是当前的格式,但是来自Facebook的人告诉我,我们不应该依赖它,它可能会在某些时候改变,最好如果你真的只使用完整的ID,随着端点返回。)

You need to use the "full" post id as you get it from the /feed or /posts endpoint – the combination of page-id, underscore, post-id. (At least that’s the current format, but someone from Facebook told me we should not rely on that, it might change at some point. Best if you really just use the full id, as the endpoint returns it.)

由于您只对全部喜欢的喜欢感兴趣,不是个人喜欢,您可以提出这样的请求,

And since you are interested in overall number of likes only, not the individual likes, you could make a request like this,

{full_post_id}?fields=likes.summary(1).limit(0)

请求摘要(包含总计数),并限制返回为零的个人喜好的数量(以便不要求任何不必要的数据)。但是我觉得对于分享的帖子,没有这样的数据,你只会得到一个帖子列表(可能不是全部,但只有那些你可以看到。)

That requests the summary (contains total counts), and limits the number of individual likes returned to zero (so as not to request any unnecessary data.) It works the same for comments. But I think for shared posts there is no such counts, you will only get a list of posts (which might not be all, but only those you are allowed to see.)

这篇关于使用PHP检索Facebook页面状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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