I'm just getting started with developing with using facebook api with php. But 开发者_如何学运维I can't seem to figure out why I get only an empty array when I invoke the following query:
$fql = "SELECT message,time FROM status WHERE uid ='".$uid."'";
$response = $facebook->api(array('method' => 'fql.query','query' =>$fql));
print_r($response);
When I use a different query like the following I'm getting result back:
$fql = "SELECT uid2 FROM friend WHERE uid1='".$uid."'";
There may be an issue with permissions. You may need to grant user_status
permission.
See here - http://developers.facebook.com/docs/authentication/permissions
Check your permissions. A great way to do this is to use the FQL Query Tool. Its great to test queries and the permissions you will need to access the data you are querying
I have the similar problem, just instead I use:
{
"id":"SELECT uid1, uid2 FROM friend WHERE uid1 = me()",
"posts":"SELECT message, time FROM status WHERE uid IN (SELECT uid2 FROM #id) ORDER BY time DESC LIMIT 50"
}
As a result I get:
{
"name": "posts",
"fql_result_set": [
]
}
If I change uid2 to uid1: (SELECT uid1 FROM #id)
I get my status updates.
2 weeks ago, this was working.
Permissions, in my case are correct.
Note: Query's are in Graph Explorer format, so they can be easyly tested
精彩评论