Facebok - Retrieving recent posts from FB API in PHP
I am working on a script to pull recent Facebook posts/status updates for
a specific using the Facebook API. I downloaded the FB SDK and searched
all over the FB developers site, SO, and other places and it seems like
the code below should accomplish what I need. However, although I am not
getting an error, I am getting a NULL result.
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'XXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXX',
));
$fbApiGetPosts = $facebook->api('***My Name***/feed?limit=5');
var_dump($fbApiGetPosts["data"]);
I have tried using my two FB accounts,(my personal acct and a test account
that I created just for this project) as well as one for my company and
each time the response was NULL. When I misspelled the account name or
used a name that did not exist I got an error, which seems to suggest the
request is going somewhere.
In the code above, I also tried var_dump-ing $fbApiGetPosts and that
result was also null
Can anybody see what the missing piece of the puzzle is?
No comments:
Post a Comment