Get names from multiple Facebook IDs

997 Views Asked by At

I'm trying to get the names and the url link to multiple Facebook ID's profiles whom I'm a friend of.

When trying to get one ID's info it's easy: $response = $facebook->api("/123456789");

I'd like to get the names from multiple IDs in the same request. Is this possible with FQL, and if so, how?

2

There are 2 best solutions below

0
On BEST ANSWER

You don't have to use FQL. You can easily query the Graph API with multiple ID separated by comma.

So it will look something like this in php:

$url = 'https://graph.facebook.com/?ids=' . implode(',', $ids);
$result = file_get_contents($url);

Or if you are using the php-sdk like this:

$result = $facebook->api('/', 'get', array('ids' => $ids));

Where $ids is an array with the IDs of the profiles or pages.

0
On

yes this is possible. the facebook sdk accepts a batch parameter with all requests in json format. for detail information u may look here

https://developers.facebook.com/docs/graph-api/making-multiple-requests/