1

I`m working on a php application to create a list of my Facebook friends who play Castleville. I succesfully setup my project to connect to Facebook, and execute a FQL query to retrieve all my facebook friends:

// other stuff, init, etc...

$fql =
"SELECT uid, name, pic_square
FROM user
WHERE uid IN
(SELECT uid2 FROM friend WHERE uid1 = me())";

$param = array(
        'method'    => 'fql.query',
        'query'     => $fql,
        'callback'  => ''
    );

//  query facebook
$fqlResult = $facebook->api($param);

//  parse results
foreach ($fqlResult as $values) {
   // process values 
}

...

Castleville has app_id = 107040076067341

I would like to know how to query the application table to achieve the desired result.

Any help would be appreciated.

...

...

LATER EDIT: (success)

Thank you for the help, it was really useful. I changed the code to retrieve entries from each of my friends' stream and check if the app_id was Castleville's. For each of my friends, I ran the following FQL query:

$fql_select_stream =
"SELECT attribution
FROM stream
WHERE source_id = " . $values['uid'] . " and app_id = " . CASTLEVILLE_APP_ID . " limit 1";

// $values['uid'] is the facebook user ID for the friend

$res = $facebook->api(array(
                'method'    => 'fql.query',
                'query'     => $fql_select_stream,
                'callback'  => ''));

if $res is not empty... we have an active Castleville player!

  • I don't think you can achieve this.There isn't an "applications" permission to explicitly ask for this,and there isn't an endpoint to access it.On top of this,facebook would probably be of the opinion that applications shouldn't know about each other,or access is too hard too code.For instance,you could inspect to see if a user has installed castleville,but also notice they have installed another app(say perhaps of a more adult nature) and they would not wish to expose this.I think it's privacy that is central here. I posted this as a comment as I would be interested in what others have to say – TommyBs Apr 18 '12 at 18:12

1 Answers1

0

You can't see if a user's friends use a specific app unless you're making the API call on behalf of that same app If this is your own app, and you just mentioned Castleville as an example, the way to do what you're asking is explained in my answer here: http://facebook.stackoverflow.com/a/7957310/21062

Aso relevant: Is it Possible to FQL list of friends who own specific phone ?(query from wallpost source) - where someone wanted to know how to see which of a user's friends use certain phones - i suggested they examine the user's news feed and see which apps made the post. In your case, you could check if any of the user's friends have posted content from Castleville onto their timeline

Igy
  • 43,710
  • 8
  • 89
  • 115
  • Thanks.. edited the original post for my solution based on your reply. – Dan Munteanu Apr 18 '12 at 22:08
  • Just be aware that isn't a definite list of 'friends that play castleville', it's 'friends that have posted something from castleville which is visible to me' - may be OK for your requirements though – Igy Apr 18 '12 at 23:42