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!