php - why facebook photo album returns an empty array? -


i'm using facebook sdk laravel 4. need return images of user log in via facebook.

when use user, app administrator on facebook, images , albums returned normally.

however, when try user other administrator, returns empty array.

the code i'm using follows:

$session = new facebooksession(session::get('facebook.token'));  $request = new facebookrequest(     $session,     'get',     '/me/albums',     ['fields' => 'name,photos.limit(20){source},id'] );  $response = $request->execute()->getgraphobject();  $imagesofallalbums = [];  foreach ($response->asarray() $albuns) {     foreach ($albuns $k => $album) {          if (empty($album->photos)) continue;          foreach ($album->photos $images) {              foreach ($images $image) {                  if (empty($image->source)) continue;                  $imagesofallalbums[$album->name][] = $image->source;             }         }    } }  count($imagesofallalbums); // 0 

if first example, return so:

[    'nome album' => [          'imagem_1.jpg',          'imagem_2.jpg',     ] ] 

in part of code, added permission user_photos:

$urlfacebook = $helper->getloginurl([                 facebookpermissions::user_photos,             ], 'v2.4'); 

the user_photos permission needed access albums work users role in app if did not send in review. called "login review": https://developers.facebook.com/docs/facebook-login/review


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -