简体   繁体   中英

FB API (PHP) - How to get photo URL

When I try to get photo data by this request

$response = $fb->get('/me/albums');
$albums = $response->getDecodedBody();

foreach($albums['data'] as $album)
{
    echo 'Album: '. $album['name'] .'<br/>';

    $response = $fb->get('/'. $album['id'] .'/photos');
    $photos = $response->getDecodedBody();

    foreach($photos['data'] as $photo)
    {
        $response = $fb->get('/'. $photo['id']);
        $data = $response->getDecodedBody();

        var_dump($data);
    }
}

I get only [ created_time, id ] of each photo. Is some privilege required to get this content?

Do I need to "user_photos" privilege accepted? I thought that admin may test it without acceptation.

You do need the user_photos permission, but you don´t need to get it approved to make it work for an App admin. You get results, so i assume your authorization is correct. The only thing that is missing are the fields, check out "Declarative Fields" in the changelog: https://developers.facebook.com/docs/apps/changelog#v2_4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM