简体   繁体   English

无法使用Facebook API获取照片

[英]Unable to fetch photos using facebook api

I am trying to fetch the photos of a user from facebook using php api. 我正在尝试使用php API从Facebook上获取用户的照片。 Currently I don't have permissions to fetch the photos from facebook. 目前,我没有从Facebook上获取照片的权限。 But I am using the same id which has been used to create the facebook app. 但是我使用的是用于创建Facebook应用程序的相同ID。 I heard that we can use the same id (the one used to create the app) for testing everything from facebook. 我听说我们可以使用相同的ID(用于创建应用程序的ID)来测试来自Facebook的所有内容。 My code for fetching user photos is :- 我获取用户照片的代码是:-

$request = new FacebookRequest(
  $session,
  'GET',
  '/{user-id}/photos'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();

Response of the above code :- Array() 上面的代码的响应:-Array()

It is returning a blank array. 它返回一个空白数组。 Is it because I do not have permissions to fetch photos or any other reason? 是因为我无权获取照片还是其他原因?

As an app admin/developer/tester you can experiment with permissions without the need of submitting for app review. 作为应用程序管理员/开发人员/测试人员,您可以尝试使用权限,而无需提交应用程序审核。 However , you still need to request the permission to be able to access the data of these endpoints. 但是 ,您仍然需要请求权限才能访问这些端点的数据。

You can easily test this on the Graph API Explorer , where you could easily request permissions and query endpoints. 您可以在Graph API Explorer上轻松测试它,在这里可以轻松地请求权限和查询端点。

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

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