Tung
Tung

Reputation: 1671

Get posts from a Facebook page by date

Facebook Page is a useful channel for us to study something. But I have a problem in filter its posts by date: get all posts by a specified date. The old posts are floated.

Is there any Facebook API supporting to do this task?

Upvotes: 5

Views: 14506

Answers (1)

ShawnDaGeek
ShawnDaGeek

Reputation: 4150

You can use the parameters since and until in conjuntion with strtotime

strtotime(); reference: http://php.net/manual/en/function.strtotime.php

Example of usage using Graph API Explorer.

// example will return first 20 posts made between 15th of March, and 5th of April 2013.
example.com/feed?since=15+march+2013&until=5+april+2013&limit=20

Live example:

https://developers.facebook.com/tools/explorer/135669679827333/?method=GET&path=shawndageek%2Ffeed%3Fsince%3D1%20january%202015%26until%3Dnow%26limit%3D20&version=v2.5

Additional info:

  • Post objects return with most recent first, so if an older post is not showing you may need to close the date gap or increase the limit=

Upvotes: 12

Related Questions