FaceBook php api get realtime updates? - php

Hi i am trying to use Realtime updates in facebook application,
My application basically backs up the user's photos, messages and friendlist, i want when a user adds a new friend data on server should also be updated, when a user adds a new album the most recent album should be downloaded automatically to my server
I got this code from github-php , but dont know what next?
Please help if anyone has done with real time updates

you need to query the code after certain interval which you can use AJAX to update the page without refresh.
There is no automatic updates without query the information every time.

You have to subscribe using one module and you specify a callback url during the subscription... you only subscribe once and you get updates for everyone who has authorized your app. The updates come to you via the callback url and its very crappy info that basically tells you that you have to go back and query fb to get the full details.

Related

Facebook Open-Graph API Subscription or Update Notification without App Permission

I'm relatively certain after reading the facebook Open Graph documentation that I can't have a web site 'subscripe' to a public page, unless that page installs my app. Let me know if that is wrong.
What I am trying to make is a photo gallery, pretty simple, but it grabs photos from a public 'page' such as a college or university.
I would like it to update itself anytime there is a change. I was hoping I could do it through the API, possibly using API updates/subscription
Facebook App Subscriptions -
but I don't think that will work. I'm using PHP, are there other ways to listen and see if there has been a change? Other than just firing off a function every now and then, using CRON or some other such server tool. I would think that facebook would probably also not like that behavior, though I'm not sure.
As of right now, I am able to grab JSON from a public page's photo gallery using the API and the photo gallery works just fine, I'm mostly just wondering what the optimal of having it update itself automatically is.
You are correct in assuming that real-time updates for pages require admin access to the page to work. You need a page access token to be able to subscribe to updates for a specific page, and such a page access token you can only get from users that have admin privileges for that page. (The page does not need to install your app as a tab any more, they changed the subscription process in that regard; but the page access token is still necessary. Basically you can say, you can not subscribe to updates for just any arbitrary page, it has to be “your” page.)
Apart from that, all you can do is check for new content by requesting the current data in a sensible interval.
you need to get page access token, which is granted when the user is one of the Page Admin, check the documentation on Facebook
https://developers.facebook.com/docs/graph-api/reference/page
look for this line
"access_token": "The access token you can use to act as the Page. Only visible to Page Admins"

Make facebook notify if an URL has hit a like or share

I am developing a web+app system and I would like to know if there is any way that Facebook tells me how many likes has an URL I post in a user wall.
What I would like is that when some users hits like, a GET (or POST) Request to my server is called so I can store the external hit in my database without having to update it every time.
Does it even exist?
Maybe FB.Event.Subscribe can help you?
From the docs:
FB.Event.subscribe allows you to define callbacks that will be called
when certain events take place on your site. These events include:
Logging in or logging out via Facebook Login
Someone likes or unlikes a page via an embedded like button
Rendering of social plugins
Comments are added or removed
Someone sending a message to your page or a friend via an embedded send button

PHP posting on page wall

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.

Updating status of a page remotely with PHP

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

How to get the page id when user removed my application from page

Am new to facebook application.
Basically i want to be notify when some one removed my application from his page.
using application > advanced > Deauthorize Callback: URl. i can able to receive signed_request.
But i needs to know the page id which page user has removed my application.
Since in my application user can add my app to multiple pages of his account.
so when he remove my app from any one of that page. i needs to know the page id.
looking forward to hear from your answers in this regards.
Unfortunately it is not possible just with "Deauthorize Callback". However, you can save current page id to your database and when your application have received this callback you'll have an idea what page what the last one.
Hope that helps.

Categories