Another problem ???
I’m trying to retrieve another array:
this is the array I get with: print_r ($resultScore);
Array ( [0] => stdClass Object ( [user] => stdClass Object ( [id] => 1378518079120107 [name] => Mary Amhheghcggci ) [score] => 267089 [application] => stdClass Object ( [name] => EatSquare [namespace] => eatsquare [id] => 760699587345565 ) ) [1] => stdClass Object ( [user] => stdClass Object ( [id] => 1374605922846447 [name] => Harrylollo Baosky ) [score] => 76102 [application] => stdClass Object ( [name] => EatSquare [namespace] => eatsquare [id] => 760699587345565 ) ) [2] => stdClass Object ( [user] => stdClass Object ( [id] => 1382836682021405 [name] => Luca Rosenthalstein ) [score] => 35297 [application] => stdClass Object ( [name] => EatSquare [namespace] => eatsquare [id] => 760699587345565 ) ) [3] => stdClass Object ( [user] => stdClass Object ( [id] => 1374550636185549 [name] => Paolo Warmanberg ) [score] => 31920 [application] => stdClass Object ( [name] => EatSquare [namespace] => eatsquare [id] => 760699587345565) ) )
and I use this script:
[php]$session = new \Facebook\FacebookSession($accessToken);
$requestScore = (new \Facebook\FacebookRequest( $session, ‘GET’, ‘/760699587345565/scores’))->execute()->getGraphObject(\Facebook\GraphUser::className());
$resultScore = $requestScore ->asArray();
$friendsScore = $resultScore[‘data’];
print_r ($resultScore);
foreach ($resultScore[‘data’] as $friendsScore) {
echo $friendsScore->name . ’ |’ . $friendsScore->id . ‘|’;
}[/php]
do you know why I get this error?
Warning: Invalid argument supplied for foreach() in /index.php on line 82  ???
I tried to change a lot of thing…but doesn’t works… I see the difference about ( [data] => Array ( and in this other array, I don’t understand why doesn’t appear… isn’t this script to do that:?
[php]$friendsScore = $resultScore[‘data’];[/php]
Thank you very much, and sorry