Display public facebook posts on your website

May 2012

Display public facebook posts on your website

comment icon7 comment(s) |

A straightforward way to get your facebook public posts onto another website without requiring your guests to have a facebook account.

  1. Log into the facebook account you want to display the posts of
  2. Go to https://developers.facebook.com/apps, it will ask you for your password again
  3. On the top right of the next screen, click on the button "+Create New App"
  4. In the first field on the form enter an "App Name" and click "Continue". You do not need to enter anything for the other 2 fields. You may then be asked to enter the captcha validation text.
  5.  On the next screen you will see values for “App ID:” and “APP Secret:”, you will use these in your code when you make a request.
  6.  Click “Save Changes”
  7. To make the request and get facebook posts add the following lines to your PHP code:


//Request to facebook to obtain an access token. Replace the Xs so client_id's Xs is the value from “App ID” and client_secret's Xs is “App Secret”

$access_str = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id=XXXXXX&client_secret=XXXXXX&grant_type=client_credentials');


//Request the public posts. Replace "YOUR-PROFILE-NAME" with your profile name.

$json_str = file_get_contents('https://graph.facebook.com/YOUR-PROFILE-NAME/feed?access_token='.$access_token);

//decode json string into array

$data = json_decode($json_str);

//Now iterate through $data to get the information you want to display.


August 31, 2012


Wrong link to developers.facebook.com

There link URL to https://developers.facebook.com/apps is incorrect, it now leads to mail.interworks.com. Copy the URL into clipboard instead of clicking through.

September 26, 2012



Thanks for the heads up, MI2; we have corrected the link!

December 11, 2012



Just the info I was looking for. I am going to use this on my new site. Thanks!

January 10, 2013


Doesn't work for me - any ideas why?


I followed your instructions to the letter and I appear to get an access token.

The only problem is when I make a call to the api it just returns an empty set :/ Any ideas?

February 14, 2013


Doesn't work for me either

Gives me an empty dataset

"data": [


April 4, 2013


error code 191(Missing redirect_uri parameter)

I am getting error code 191(Missing redirect_uri parameter)
Where should I set the redirect uri. Is it in facebook seeting page?

August 14, 2013