I have a facebook graph api request which brings back this response
Facebook\\GraphObject Object
(
[backingData:protected] => Array
(
Here is the way:
$user_profile = (new FacebookRequest(
$session, 'GET', '/me/albums'
))->execute()->getGraphObject();
$album = $user_profile->getProperty('data');
$album_data = $album->asArray();//this will do all job for you..
foreach($album_data as $row){
var_dump($row);
}
For the New version Graph API v2.5 of Facebook Read read data as below :
$fb = new \Facebook\Facebook([
'app_id' => 'KEY HERE',
'app_secret' => 'SECRET HERE',
'default_graph_version' => 'v2.5',
]);
$asscee_t ="ACCESS TOKEN HERE";
$response = $fb->get('/me/friends', $asscee_t);
$get_data = $response->getDecodedBody(); // for Array resonse
//$get_data = $response->getDecodedBody(); // For Json format result only
echo $get_data['summary']['total_count']; die; // Get total number of Friends
https://developers.facebook.com/docs/php/GraphObject/4.0.0
getProperty
getProperty(string $name, string $type = 'Facebook\GraphObject')
Gets the value of a named key for this graph object. If the value is a scalar (string, number, etc.) it will be returned. If it's an associative array, it will be returned as a GraphObject cast to the appropriate subclass type if provided.
$user_profile = (new FacebookRequest(
$session, 'GET', '/me/albums'
))->execute()->getGraphObject();
$id = $user_profile->getProperty('id');
full list of field in https://developers.facebook.com/docs/graph-api/reference/v2.0/album