Facebook API - 如何通过Facebook API获取Facebook用户的个人资料图像(无需用户“允许”应用程序) [英] Facebook API - How do I get a Facebook user's profile image through the Facebook API (without requiring the user to "Allow" the application)
问题描述
我正在开发一个 CMS ,从Facebook Facebook中获取用户的个人资料图片href =http://en.wikipedia.org/wiki/Uniform_Resource_Locator =noreferrer> URL (即 http://facebook.com/users_unique_url )。我该如何做到这一点?有没有Faceboook API调用获取用户的个人资料图像URL,而用户不需要允许应用程序?
I'm working on a CMS that fetches a user's profile image from their Facebook URL (that is, http://facebook.com/users_unique_url). How can I accomplish this? Is there a Faceboook API call that fetches a user's profile image URL without the user needing to Allow the application?
推荐答案
只需通过网址获取数据:
http://graph.facebook.com/userid_here/picture
将 userid_here
替换为要获取照片的用户的ID。您也可以使用HTTPS。
Replace userid_here
with id of the user you want to get the photo of. You can also use HTTPS as well.
您可以使用PHP的 file_get_contents
函数来读取该URL并处理检索数据。
You can use the PHP's file_get_contents
function to read that URL and process the retrieved data.
资源:
http://developers.facebook.com/docs/api
注意:在 php.ini
中,您需要确保 OpenSSL 扩展被启用使用PHP的 file_get_contents
函数来读取该URL。
Note: In php.ini
, you need to make sure that the OpenSSL extension is enabled to use thefile_get_contents
function of PHP to read that URL.
这篇关于Facebook API - 如何通过Facebook API获取Facebook用户的个人资料图像(无需用户“允许”应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!