Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Forked from reducedhackers/getFacebookpageposts.php
Created January 4, 2018 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ilgrim/11b24b9fb163552911c92306e9dab8e2 to your computer and use it in GitHub Desktop.
Save Ilgrim/11b24b9fb163552911c92306e9dab8e2 to your computer and use it in GitHub Desktop.
Getting the most recent posts from a Public Page .
<?php
/*
This may be a long way around a short problem .. but
The PHP SDK from Facebook :
git clone https://github.com/facebook/php-graph-sdk.git
Im using my own FB App to give me a Token/Secret
/*
require_once '<path to git clone https://github.com/facebook/php-graph-sdk.git >/php-graph-sdk/src/Facebook/autoload.php';
$APPID="1234567890987532";
$APPSECRET="abcdefghij123453212sd";
$PAGEID="pagenamefromurl";
$fb = new Facebook\Facebook([
'app_id' => $APPID,
'app_secret' => $APPSECRET,
]);
$fb->setDefaultAccessToken($fb->getApp()->getAccessToken());
$request = $fb->get('/'. $PAGEID . "/posts?limt=5");
echo print_r($request);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment