简体   繁体   English

FB API (PHP) - 如何获取照片 URL

[英]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.我只得到每张照片的 [ created_time, id ]。 Is some privilege required to get this content?获取此内容是否需要某些特权?

Do I need to "user_photos" privilege accepted?我需要接受“user_photos”权限吗? 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.您确实需要user_photos权限,但您无需获得批准即可使其适用于应用程序管理员。 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唯一缺少的是字段,请查看变更日志中的“声明性字段”: https : //developers.facebook.com/docs/apps/changelog#v2_4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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