Reputation: 11
I want to find out the latest comments and likes on a facebook page given a timestamp. Is there a way we can fetch this data from the facebook API? For example : If a user A posted something on my page 30 days back, and user B liked the post and commented on it today. I need to get these activities in the response if I try and find out all activities on my page in the past 2 days (even if the post is 30 days old).
Upvotes: 0
Views: 550
Reputation: 636
That is not working via the API, the since parameter only works on posts. A possibility is:
comments_after_that_time = 1349285260;
$comments = json_decode(file_get_contents("https://graph.facebook.com/[yourpost_id]/comments?access_token=xxx"));
foreach($comments->data as $comment)
{
if(strtotime($comment->created_time) > comments_after_that_time)
{
echo "we have a new comment";
}
}
Upvotes: 1