tags:

views:

47

answers:

1

I want a simple thing with Facebook API, but I don't know if it's possible.

I am building a PHP app (with the official facebook PHP api), that does something with user's status updates. What I would like to know is their total count.

However, as I found out, reading ALL status messages by something like

$facebook->api('/me/statuses?limit=2000');

takes too long (and fails, half of the time), since the result is too big (it returns all the updates, plus all the comments and "likes").

Facebook documentation is quite confusing, so I am asking here - is there any way of getting the count, without reading them all?

+1  A: 

Probably FQL would be faster:

SELECT status_id FROM status WHERE uid=me() LIMIT 2000

FQL doesn't support COUNT, but you can select an empty string, that way amount of returned data would be lighter (array of empty elements is returned):

SELECT "" FROM status WHERE uid=me() LIMIT 2000
serg
this seems great. However, I have no idea how to call FQL from facebook.php from here http://github.com/facebook/php-sdk/
Karel Bílek
OK, I found it here http://thinkdiff.net/facebook/php-sdk-graph-api-base-facebook-connect-tutorial/ . Why it's not in the documentation? :-(
Karel Bílek
anyway, you are right. only the documentation can be... better.
Karel Bílek

related questions