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 中获取用户的个人资料图片
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?
推荐答案
只需通过这个URL获取数据:
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屋!