DOCbrink DOCbrink - 15 days ago 9
PHP Question

How to managed facebook post in own database for better manipulation?

Imagine I want to store in my database the facebook posts from a user/page for getting them and manipulate them simplier.

I will make a php script that will be launch every day for each user/page who will get the posts I don't already have in my database and insert them.

Now, on my front website, you can log in, and see your posts.

Now, you go on facebook, and modify one of your post.

Now you come again on my website, and obviously, you don't see the modification you did on facebook, because this modification is on facebook database and not in mine, and your posts a retrived from my Database.

Theorically, one of the solution will be that facebook has a "log" table for posts, where i can find something like "this posts has be updated" so i can update my table. Something like that exist ?

If not i have a second solution, at each posts send from my server to my website, update it automatically with facebook database (getById the post on fb an update it in my db) and after that send the posts to my website. But this will be a mess and a lot of request for nothing.

So how can i do this ? Someone have already tried this ? Or only directly manage the posts from facebook database ?

Thanks =)

Answer

Facebook has a mechanism to send updates to you, called webhooks.

https://developers.facebook.com/docs/graph-api/webhooks

You can subscribe to several fields for users or pages, among them the feed.

You’ll have to check if it delivers updates to already existing posts as well - but I think it should, would make little sense if it didn’t.