Issue
I'm trying to retrieve my Facebook's friends count with the PHP SDK v5.
// $access_token is already being successfully filled, using this example:
// https://developers.facebook.com/docs/php/howto/example_facebook_login
$response = $fb->get('/me/friends', $access_token);
# obtain user object
$user = $response->getGraphEdge();
# test
echo '<pre>';
print_r($user);
echo '</pre>';
This is the result:
Facebook\GraphNodes\GraphEdge Object
(
[request:protected] => Facebook\FacebookRequest Object
(
[app:protected] => Facebook\FacebookApp Object
(
[id:protected] => 1864094063814172
[secret:protected] => d71134d1a3efd829060395e73288cc4b
)
[accessToken:protected] => EAAafYjiAZAhwBALvYZARvbP4ZCUucDp1yqcK4yIZBVZC3rxnhivyaKwJzAQzXGmb2E6ZBEKAZClKtw07dzDWLbZCKxk1XlgMzKl4NGvfHkyTPFsdv9wD2y7YpyuFPZAhZCQqry1ZCx5pCKXbqZBg0S1nckijNG57McCoQGwZD
[method:protected] => GET
[endpoint:protected] => /me/friends
[headers:protected] => Array
(
[Content-Type] => application/x-www-form-urlencoded
)
[params:protected] => Array
(
)
[files:protected] => Array
(
)
[eTag:protected] =>
[graphVersion:protected] => v2.8
)
[metaData:protected] => Array
(
[summary] => Array
(
[total_count] => 560
)
)
[parentEdgeEndpoint:protected] =>
[subclassName:protected] =>
[items:protected] => Array
(
)
)
How do I get the total_count value (560)? Am I missing something?
Thanks!
Solution
Per the docs, your Facebook\GraphNodes\GraphEdge
has a getMetaData
function to access that metaData:protected
section.
Answered By - ceejayoz
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.