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 =)
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.
Related
My client has a Facebook page which has his latest posts and shows the reviews people have added.
I want to grab these from Facebook, and output them on his website all styled up nicely with my own markup and styles.
I have had this running in JavaScript with the access token pasted in the JS which is obviously not the way to go, and the token will expire. Now im trying to do the same with PHP. I've read & watched more clips than I care to mention, and I cant get my head around one particular part. Every demonstration i've read or watched requires the website user to login to facebook before this data is returned.
I cant expect ever user who goes on the site to do that. Am I missing something? I just want get the data and display it. No Adding, No Deleting, No Updating. Just display the same information on his website.
Sorry if am asking something stupid here, i'm a novice and for all my efforts I am struggling to understand. I kind of need it in laymans terms so to speak.
Thanks in advance.
I'm trying to recreate a Facebook page tab application similar to this one: https://www.facebook.com/andrewchristian/app_118098318208381
Up to now, using FQL, I plan on fetching user data (if the user liked/commented on a post) and display a list with an order based on their activity. It will be a cron running once or twice a day. The only thing I'm missing is a way to know if the user has shared any of the page's posts.
I've been digging around in the FQL tables (the link is for the stream table) for any clues but I cannot find anything to work with. Has anyone done something similar? Any other ideas on how I can fetch such information? This has to work as "per user", I'm not not interested in the total count of shares on a post.
P.S.: If there is something that counts a user's total likes/comments/shares on a Facebook Page, I'd really like to know about that as it would make my life much easier, I'm open to any suggestion!
Thanks in advance!
I have a website where users can post jobs for free. How can I link these posts to a facebook page about this website? I don't want the users to login to fb.
At this moment I post them to twitter and then using selective tweets to post them on my page. But selective tweets is not able to post logo's specific for that job.
I created a fb app. Did not select anything just gave it a name and got an appID and appSecret. I dont now what to select in "Select how your app integrates with Facebook". Becouse it is not a mobile app and it is not a website with fb login.
Kind regards.
you can use share on facebook facility of facebook ,from http://developer.facebook.com.
you can easily add this to your website.
have fun!
You can do this easily via MYSQL and PHP, depending on how your current site is setup. What i would do is store the jobs into a separate table while saving, like this
(table) Facebook
pageid //numerical value
header //job title
message //job description
So that you can use it for the next part.
Create an application via Facebook and give it authentication to users and your Facebook page.
by adding this application to your page you can then call something like :
$facebook->set_user($user, $session_key);
$facebook->api_client->stream_publish($item['header'], $item['message'], $item['pageid']);
Using your keys from facebook.
Then you can run a Cron that updates every x minutes, and after it has posted it, in an array, you can clear the table for the next row of jobs.
Let me know where you are on this and ill try to help as much as possible.
I have an online blog which is custom written, by myself, with PHP. The articles & other features publish themself on a predefined date, which means that I can have 2 months of future content already lined up & writen, meaning that the site is constantly updating itself without my assistance.
Now I want to be able to update the facebook page, asociated with the blog, automatically. Is it possible to do this? All I want is for a new status to be made every time a new article is published, without me having to do it manually.
Any help would be great.
You would need to set-up a cron job (Scheduled task) to make this possible. This can be viewed in the administrative panel.
You need to assign a (cron) file that lets you check your articles publishing date and today's date.
Have you looked into facebook's api and what it could do with facebook pages. I have never tried exactly what you want to do, but from my experience it seems that is very likely. I know you can automatically request an access_token and use that to publish updates onto a pages wall.
I think the combination of these two articles is what you are looking for:
How to update a facebook page status using the facebook api
X
Update your Facebook status using PHP and Graph API
I am trying to show the comments from my facebook page post on my PHP website. I like the comments to be synced, so where the user enters comments on the facebook post of my page, it will automatically show up on my website. I know how to create the comment box, but it's doesn't pull the comments from the page.
for the comment box I have:
<div class='fb-comments' data-href='https://www.facebook.com/media/set/?set=a.182291248558753.39531.182290545225490&type=1&l=d607ba4dcc' data-num-posts='3' data-width='470'></div>
I am trying to show the comments that were left on my post, but it's not pulling it. I have looked at the graph API but can't figure out which on get the comments and how to get the so called "primary key" for the comments.
I have looked at the following fql:
Stream: but I don't know what the "post_id" is supposed to be. https://developers.facebook.com/docs/reference/fql/stream/
Comment: but I don't know what the "post_id","object_id", or "xid" would be for a post in a page of the an album. I even tried to replace the URL in the example post they had, but it seems like FB FQL can't parse that kinda url. https://developers.facebook.com/docs/reference/fql/comment/
Even when we get a list of comments, I am not sure how the fb:comments plugin can use the stream to populate my page, don't know if it's possible!
Any help would be greatly appreciated.
You could use Facebook PHP SDK for this which you can get from github. You can then use it to retrieve the comments from the post and store them in a database, updating every now and then to stay current. This will mean less requests to Facebook. When a user posts on your site using your form you can then send the post to Facebook using the SDK.
The problem with this method is that you will need to create an app and users will have to authorise the app for it to be able to post as them. So maybe it's not such a good idea, but I've typed all this in now so I'm not going to delete it.