Designing my first app against the Graph API, using version 2.1.2 of the Facebook supplied PHP library. Trying to maximize performance, etc out of the box and want to batch
Just an update for the new graph Batch API: You can also execute that as follows:
// Save your method calls into an array
$queries = array(
array('method' => 'GET', 'relative_url' => '/me'),
array('method' => 'GET', 'relative_url' => '/me/groups')
);
// POST your queries to the batch endpoint on the graph.
$batchResponse = $facebook->api('?batch='.json_encode($queries), 'POST');
// Return values are indexed in order of the original array, content is in ['body'] as a JSON
// string. Decode for use as a PHP array.
$user_profile = json_decode($batchResponse[0]['body'], true);
$user_groups = json_decode($batchResponse[1]['body'], true);
That should do the trick.