Created
September 18, 2017 12:37
-
-
Save reducedhackers/2613fc9de2c39333d7d9b235938347b6 to your computer and use it in GitHub Desktop.
Getting the most recent posts from a Public Page .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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
Based around ..
https://developers.facebook.com/docs/php/Facebook/5.0.0
get()
public Facebook\FacebookResponse get(
string $endpoint,
string|AccessToken|null $accessToken,
string|null $eTag,
string|null $graphVersion
)
Sends a GET request to Graph and returns a Facebook\FacebookResponse.