Facebook API - How do I get a Facebook user's profile image through the Facebook API (without requiring the user to "Allow" the application)

John Himmelman picture John Himmelman · May 12, 2010 · Viewed 446.5k times · Source

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?

Answer

Sarfraz picture Sarfraz · May 12, 2010

Simply fetch the data through this URL:

http://graph.facebook.com/userid_here/picture

Replace userid_here with id of the user you want to get the photo of. You can also use HTTPS as well.

You can use the PHP's file_get_contents function to read that URL and process the retrieved data.

Resource:

http://developers.facebook.com/docs/api

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.