I am using the new Facebook PHP SDK. I trying to get the name of all the pages liked by the user. But it is only returning me 25 of them. As far as I know if I have to get all of them then I will have to use the "next link" in the "paging" returned by the "graphObject".
But I have no idea how to use it. And if I am wrong then can you point out how can I do it?
I'm doing this in php in order to get all the likes:
public function getLikes () {
$likes = array();
// Custom method! Get the session however you like
$session = $this->getSession();
$request = new FacebookRequest(
$session,
'GET',
'/me/likes'
);
do {
$response = $request->execute();
$graphObject = $response->getGraphObject();
$some_likes = $graphObject->getProperty('data')->asArray();
$likes = array_merge($likes, $some_likes);
} while ($request = $response->getRequestForNextPage());
return $likes;
}
As you can see, the getRequestForNextPage() method is the key.