Display your latest facebook posts in your website

Facebook has no option right now to generate your post as feed structure. So you can not get your post feeds. But still you can get the list of your posts and show them in your website or blog. In my last post (Share the comments of your youtube Video in your website) I mentioned the steps to get the feed from youtube and now I am writing the same with a different way for Facebook.

facebook postsHere is the PHP code. You need to place this in your template.

//function to retrieve posts from facebook’s server
function loadFB($fbID){
//load and setup CURL
$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
//get data from facebook and decode JSON
$page = json_decode(curl_exec($c));
//close the connection
//return the data as an object
return $page->data;
//BE SURE to enter your facebook id here
//how many posts to show
//variable used to count how many we’ve loaded
//call the function and get the posts from facebook
//set timezone (change this to your timezone)
//loop through all the posts we got from facebook
foreach($myPosts as $dPost){
//only show posts that are posted by the page admin
//get the post date / time and convert to unix time
$dTime = strtotime($dPost->created_time);
//format the date / time into something human readable
//if you want it formatted differently look up the php date function
$myTime=date("M d Y h:ia",$dTime);
<li><?php echo($dPost->message);?>
<?php echo $myTime;?></li>
//increment counter
//if we’ve outputted the number set above in fblimit we’re done
if($fbCount >= $fbLimit) break;

Two things you must do for working out this script.

1. Make sure your server is cURL enabled
2. You will have change the Facebook ID in the script by yours.

That’s all…

  • Roors Philip

    This is a great info you shared. I will try it on my site :)

    Thanks buddy.

  • Mohon Shrinibhasana

    Got some tricks from other blogs but none of those works. They are still showing info about fb rss which no longer exists. Just checked this to my demo and it works fine.

    thanks a lot, waiting for more research work on it. keep posting.

  • Kate Mccue

    I am very interested in. May I ask to spoon feed the detail please?

  • Zola Marable

    Nice work. You keep working on this blog please.

  • Truck Pilot

    Awesome work! Keep posting good material.

  • William Johson

    I am very interested in. May I ask to spoon feed the detail please?

  • Erasmo

    Greetings I stumbled on your blog by mistake when i searched Live search for this topic, I have to point out your blog is actually helpful I also love the style, it is superb!

  • How To Quit Smoking

    You must be a genious. I love your posts, will come back later.

  • Andre Belman

    Lovely site! I am loving it!! Will come back again. I am bookmarking your feeds also

  • Andrea Barczak

    thanks for sharing

  • admin

    Thanks a lot all of you for your feedback :)

  • nathalie

    I will talk about it to my friends. Thanks ;)

  • Melodee Labrada

    Im grateful for the blog post. Really Cool.

  • karen millen dresses

    Thank you for your provided information.

  • Sharecash Bypass

    Would love it if someone would further explain this to me?

  • simarjeet singh


    thanks is script

    working very well,

    but i have a question?

    is there any limit to access data my mean to hit a URL .

    is there any limit to hit a URL on facebook in one day or month.

    hope u can understand what i am asking you.


    • admin

      There is no limit.

  • Gale Soderberg

    Thank for this great post, i like what you read.

  • Denese Schrupp

    Terrific post, plenty of really good data. I wish to show my friend and get them the things they think.

  • Sandra

    It has worked perfectly till now… if you go to url… you get an error "An access token is required to request this resource." anyone knows the problem?

  • Sophie

    Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Anyway I'll be subscribing to your feed and I hope you post again soon.

  • simarjeet singh


    this script is not wrork now, please help me why this happen , return error is


    "error": {

    "type": "OAuthException",

    "message": "An access token is required to request this resource."



    how i can get a access token.


  • Nona Crosser

    decided listing you procure

  • Garage Doors NJ

    This really answered my problem, thank you!

  • Rex Brauer

    Love the information here. Adding to my bookmarks. Thank you!

  • Luther Cassel

    I must know where you got your layout from im trying to start my own blog and yours is the coolest.

  • Bredgediema

    Thanks For This Blog, was added to my bookmarks.

  • Tommy Busk

    It’s some shame you don’t have a relatively donate press button! I’d most certainly donate to this excellent blog! I just think in the meantime i’ll settle for bookmarking not to mention putting a Rss feed towards your Search engine profile. I just take a look ahead towards unique updates and often will promote this unique weblog with the help of your Squidoo group: )

  • Johnnie Stpierre

    It’s your pity you actually don’t have got a donate switch! I’d most likely donate to this remarkable blog! I actually suppose that at this point i’ll settle for book-marking plus placing a person's Rss feed so that you can this Bing akun. I actually glance forth so that you can fresh posts but will show the following blog site by using this Twitter group: )

  • Nigel Blancarte

    It’s an important pity you actually don’t have a very good donate link! I’d most likely donate to this spectacular web site! As i presume at this point i’ll be happy with book-marking and even placing ones own Rss feed to help you a Google and yahoo credit account. As i start looking forwards to help you innovative posts and will eventually publish it website through a Facebook . com group: )

  • Nicholas William

    Your website is fantastic, great ideas and very professional. TQ

  • Aura Casini

    This is very interesting, You are a very skilled blogger. I've joined your feed and look forward to seeking more of your excellent post. Also, I have shared your site in my social networks!

  • Terri Coverstone

    Wow! Your article has quite a few comment posts. How did you get so many readers to look at your post I'm envious! I'm still learning all about article writing on the web. I'm going to click on more articles on your website to get a better idea how to attract more people. Thank you!

  • Ethelene Montas

    I just found this Site. Just wanted to let you know that I really like it.

  • Claudine Lagle

    Fantastic goods from you, man. I have understand your stuff previous to and you are just extremely wonderful. I really like what you've acquired here, really like what you are stating and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I can not wait to read far more from you. This is actually a tremendous website.

  • Carroll B. Merriman

    Hi there would you mind letting me know which hosting company you're utilizing? I've loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most. Can you suggest a good internet hosting provider at a fair price? Thanks, I appreciate it!

  • Vicky Basler

    Hey there, You've done a great job. I’ll definitely digg it and personally suggest to my friends. I am confident they will be benefited from this site.

  •;u=25534 Johanna Malory

    Excellent articles, There’s a lot of nice info here, although Used to do want tell you something, I’m operating Redhat together with the up-to-date beta associated with Firefox, and also the look of your site is kind of wonky for me personally, I'll check out content articles, but the routing doesn’t function so well.

  • Brinda Dech

    This is tough. I?m not pointing fingers at you though, personally I think that its those that aren?t motivated to

  • Ahmad Cabreja

    Applause for this post – one of your best!

  • Melani Tramontano

    I’m not that big of a web reader to be honest, your site is really nice, keep it up! I’ll go on and save your website to come back in the future. Greetz from solar

  • Willow Gollnick

    Boys Love Loose Moms

  • Florine Wloch

    Thought I would comment and say neat theme, did you code it on your own? It looks really good!

  • Stanley Clarbour

    Great content material and great layout. Your blog deserves all of the positive feedback it's been getting.

  • pavilions

    Good article , thanks and we want more! Added to FeedBurner as well

  • Deangelo Schuchmann

    Right here is the kind of information I've long been searching for. Thank you for writing this information.

  • Nelida Dye

    as I website possessor I conceive the subject matter here is very excellent , thankyou for your efforts.

  • denver chiropractors

    Thanks for the great info.

  • Velda Aitkin

    I delight in, lead to I found exactly what I was looking for. You have ended my four day lengthy hunt! God Bless you man. Have a great day. Bye

  • Anette Dezell

    I am glad that I discovered this web blog, exactly the right information that I was searching for!

  • Ronn

    Well, I read all your posts for now…I'llcome back tomorow for more great posts!

  • Rashad Heemstra

    You have some seriously important information composed here. Excellent job and keep posting great stuff.

  • Jordon Papitto

    Hi there could I use some of the information from this site if I link back to you?

  • Donn Daubendiek

    sweet blog thanks for to make it

  • iliyas

    hi, thanx for the code. I’ve tried it but it shows me error..

    [error] => stdClass Object
    [message] => An access token is required to request this resource.
    [type] => OAuthException
    [code][/code] => 104

    can you help me out?