0

I am having trouble getting all the facebook posts, message, photos etc... that show up on my wall via the Facebook API. Basically, many items are missing in the result set. I tried the following with FQL:

 $facebook = new Facebook(array(
                'appId' => FB_APPID,
                'secret' => FB_SECRET,
                'cookie' => true
      ));
      $fql = "SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id =me() ORDER BY updated_time DESC";

   //Create Query
   $params = array(
       'method' => 'fql.query',
       'query' => $fql,
   );
   //Run Query
   $result = $facebook->api($params);

But this feed seems to be missing some items, and i don't know why.

I also tried with reading the graph feed at http://graph.facebook.com/me/feed?access_token=<Access+token> and again, i also don't get all the feed items.

What is the problem? Why am I missing some items?

Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
John
  • 32,403
  • 80
  • 251
  • 422

1 Answers1

2

use facebook->getLoginUrl with Permissions, see https://developers.facebook.com/docs/reference/login/#permissions

$applicationurl = 'http://{yourwebsite}/facebook.php';

// Get User ID
$user = $facebook->getUser();

if(empty($user))
{
   $params = array(
  'scope' => 'email',
  'redirect_uri' => $applicationurl
   );   

$loginUrl = $facebook->getLoginUrl($params);
header('Location: ' . $loginUrl ."\r\n");
exit;
} 

Use this code before your query. You can use $user in your query like uid = '.$user. Set your permissions in the scope part of your request, email in the example above.

EDIT OP says use the scope 'read_stream', and it works

John
  • 32,403
  • 80
  • 251
  • 422
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
  • i did use getLoginUrl to authenticate the user. My scope was publish_stream . I'm trying other scopes, but so far i don't see a difference. Which scope do you suggest? – John May 20 '13 at 14:47
  • oh i figured it out. The scope shoudl be read_stream. now it starts showing me all my wall feeds. – John May 20 '13 at 14:55