简体   繁体   English

如何在PHP中获取上周的Facebook帖子

[英]How to get facebook posts from last week in php

I need to get all my facebook posts (field "message" and "date") from specific time period in example last week. 我需要获取上周示例中特定时间段的所有Facebook帖子(“消息”和“日期”字段)。

I need them in php variable. 我需要在php变量中。

Can You help me? 你能帮助我吗?

This give me only last 25: 这只给我最后25个:

$pageFeed = $facebook->api('1750433298/feed');
       print_r($pageFeed);

API returns JSON object, which consists of "data" array (your messages) and "paging". API返回JSON对象,该对象由“数据”数组(您的消息)和“分页”组成。 "Paging has 2 fields, "previous" and "next". In order to get more of your messages you need to follow the link, given in "next" field. “分页有2个字段,“上一个”和“下一个”。要获取更多消息,您需要点击“下一个”字段中给出的链接。

$pageFeed = $facebook->api('1750433298/feed');
$next = $pageFeed["paging"]["next"]; //contains link to set of next 25 messages
$exp = explode("until=",$next);
$until = $exp[1]; // timestamp of last message in next set
$nextPage = $facebook->api('1750433298/feed', "GET", array(
'limit' => 25,
'until' => $until
));

Try this: 尝试这个:

1750433298/feed?since=2012-12-31&until=2013-01-06&limit=200

You may still not get all your posts. 您可能仍未获得所有帖子。 Feed has some tight limits, so you may need to execute multiple queries via the pagination links to get them all. Feed有一些严格的限制,因此您可能需要通过分页链接执行多个查询才能全部获得。

If you need more control of what gets returned, look at querying the stream table with FQL. 如果您需要更多控制返回的内容,请查看使用FQL查询stream表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM