Facebook group posts on own webpage in PHP

A friend needed his FB groups posts embedded on his webpage so here are some snippets that I don't forget :D
  1. At https://developers.facebook.com create a new APP, after creating you get the required ID and SECRET.
  2. From https://github.com/facebook/facebook-php-sdk download the PHP SDK

require_once(WB_PATH."/include/facebook/src/facebook.php"); // Get from https://github.com/facebook/facebook-php-sdk


$config = array(
    'appId' => $APP_ID,
    'secret' => $APP_SECRET,
    'fileUpload' => false,
    'allowSignedRequest' => false,

$facebook = new Facebook($config);

$posts = '';
foreach ($data as $d) {
    if (!empty($d['message'])) {
        $posts .= '
  • '.date('d.m.Y H:i', strtotime($d['created_time'])).'


  • '; } }

    During googling I found http://pastebin.com/LPnzUQSF, but I didn't try.

    No comments:

    Post a Comment