I want to use Facebook PHP SDK v5 to get a list of photo albums for a Page.
I am following the instructions at https://developers.facebook.com/docs/graph-ap
Have a look at the docs at
Sample code:
$fbApp = new Facebook\FacebookApp('{app-id}', '{app-secret}');
$request = new Facebook\FacebookRequest($fbApp, '{access-token}', 'GET', '/{page_id}/albums');
// OR
$fb = new Facebook\Facebook(/* . . . */);
$request = $fb->request('GET', '/{page_id}/albums');
// Send the request to Graph
try {
$response = $fb->getClient()->sendRequest($request);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
print_r($graphNode);