I'm using the PHP Facebook SDK and graph API to get all the likes of all of a user's friends. Problem is it's taking quite a while to execute.
Currently I'm getting all the user's friends, then individually looping through each friend and collecting all their likes.
To speed things up, I want to batch every 50 "/user_friend_fbid/likes" requests (but also do paging for these as well).
i.e. this:
foreach (facebookUserFriends($fb_id) as $friend) { //custom func returns friends
facebookUserLikes($friend['id'],$fb_location); //custom func returns all user likes
}
...versus:
$i = 0;
foreach (facebookUserFriends($fb_id) as $friend) {
$queries[$i]['method'] = 'GET';
$queries[$i]['relative_url'] = $friend['id'].'/likes';
if ($i==49) {
batchProcess($queries); //custom func returns all likes (but doesn't do paging)
$i = 0;
}
$i++;
}
TL;DR how do I perform paging within a batch query?