Fetching profile picture and name and etc. from Facebook by ID

时间:2016-08-29 07:54:01

标签: php html json facebook facebook-graph-api

I used this link in 2014 in php to fetching profile photo, name, surname and other information from Facebook by just ID number. http://graph.facebook.com/ {ID} / - 此链接返回了json编码信息,我可以解码并使用。但是现在在2016年这个链接不起作用。似乎Facebook改变了它的图形结构,我现在如何使用它?用另一种方法?

2 个答案:

答案 0 :(得分:0)

您可以使用javascript Graph API获取“我”(授权您的应用的用户)图片。

FB.api(
  '/me',
  'GET',
  {"fields":"id,name,picture"},
  function(response) {
      console.log(picture.data.url);
  }
);

您可以在facebook的工具Graph API Explorer

中使用Graph API

详细了解图谱API javascriptphp

答案 1 :(得分:0)

检查Graph API Changelog。看起来您使用的是旧的v1.0版API。它已经过时了。要获取用户的公开个人资料,您应该使用/v2.7/{user-id}网址。

此外,自v2.0起,您无法获得具有默认public_profile权限的朋友列表。您的应用还应具有user_friends权限。

相关问题