get latest status update from facebook page
How do i grab the latest status update from a f开发者_StackOverflow中文版acebook page in php? Not a users profile but a page (that you can like)? The documentation is a nightmare. Having trouble finding an answer to this!
Pages are just the same as profiles in terms of accessing them though the graph. To get the wall posts from a page you use the url https://graph.facebook.com/PAGE_ID/feed
.
Adding a limit parameter will return only the most recent: https://graph.facebook.com/PAGE_ID/feed?limit=1
.
Here's a quick and dirty example of how this would work in PHP:
try {
$feed = $facebook->api('/PAGE_ID/feed?limit=1');
} catch (FacebookApiException $e) {
error_log($e);
}
精彩评论