简体   繁体   中英

Custom Activity Feed for Facebook Page

Research and Reasoning

I haven't worked on a Facebook Application for a while, thus am a little rusty with how the Graph API works.

I have had a look at various topics and pages such as:

  1. https://developers.facebook.com/docs/reference/plugins/activity/
  2. How to Style Facebook Activity Feed

From what I can gather, getting the activity of a facebook page is pretty simple, however, before I proceed, there are a few things I would like to iron out before to ensure I build the app or write the script in the best possible way...

My Question

I would like to gather the status updates of a Facebook Like page and then feed this data to my News page on the website I am building.

My method would be a simple call to the Graph API to gather the data, and then display it on screen.

My question is, can I do this without creating a Facebook App, and therefore do I even need the PHP SDK?

Is it possible to achieve it like so and are there any request limits:

$url = 'https://graph.facebook.com/LIKE_PAGE_ID/feed';
$result = json_decode(file_get_contents($url));

If the above is the correct answer to this question then please let me know and I will close this question

Update

I have tried the above URL with my like page and it says that I need an Access Token. This is what I feared... Is it possible to get this data without being logged in, and without having set up a Facebook Application?

Why not create a Facebook app and use App Access Token to retrieve the feed for the Public pages.

Though you might get feed of some pages without app access token or response for different end points without access_token , but as the Facebook's API is constantly changing, and would finally settle with authorized request to their end points, I would suggest you to use the App Access Token which is can be created with the format

App_ID|App_Secret

So instead of your call for $url that you had you can change it to

$url = 'https://graph.facebook.com/LIKE_PAGE_ID/feed?access_token=App_ID|App_Secret';

Which you can then json_decode . Also there is nothing on binding to use PHP SDK, and in your case, it is not even required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM