Using php-sdk I obtain pages in this way:
$array = $this->instance->api(
'/' . $fb_user . '/accounts', 'GET', array('access_token' => $access_token)
);
Now var_dump($array['data']); gives me:
array (
0 =>
array (
'name' => 'my name 1',
'access_token' => '***',
'category' => 'Electronics',
'id' => '***',
),
1 =>
array (
'name' => 'my name 2',
'access_token' => '***',
'category' => 'Application',
'id' => '***',
)
Only the first item is a page, the second is an app. Any way to distinguish them or improve this snippet?
EDIT: Using the category field seems a too weak procedure.
If you don’t want to rely on “category”, you need to fetch informations from these ids.
Run a query for:
Among other things, there will be field:
or:
To avoid long responses, you may consider Batch Requests as described: