通过Facebook Graph API拉动照片 [英] Pulling in photos via Facebook Graph API

查看:80
本文介绍了通过Facebook Graph API拉动照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提取当前登录的个人资料的标记照片。有一个会话ID,但它看起来是一个空数组。

I'm trying to pull in tagged photos of the current logged in profile. Got a session ID but it appears it's an empty array.

<?php 
$photos = $facebook->api('me/photos');
$number_of_photos = count($photos[data]);
?>

<?php for ($i=0; $i < $number_of_photos; $i++) :?>
<img src="https://graph.facebook.com/me/photos/<?php echo $photos[data][$i][url]; ?>"/>
<?php endfor; ?>

我知道这段代码可能真的很糟糕,我是PHP的新手,只是试着一些事情。

I'm aware this code is probably really awful, I'm new to PHP and just trying a few things.

推荐答案

正如文档所述这里(向下滚动到连接),为了获得用户的照片,她必须明确地给你以下权限之一:

As stated by the documentation available here (scroll down to 'Connections'), in order to get user's photos she must have explicitly given you one of the following permissions:


  • user_photo_video_tags

  • friend_photo_video_tags

  • user_photos

  • friend_photos权限

  • user_photo_video_tags
  • friend_photo_video_tags
  • user_photos
  • friend_photos permissions

这篇关于通过Facebook Graph API拉动照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆