Home > Article > Backend Development > How to Fetch a User\'s Facebook Profile Image without Authorization?
Problem:
Retrieving a user's Facebook profile image for a content management system (CMS) without requiring the user to grant app permission.
Solution:
Utilize the Facebook Graph API endpoint:
http://graph.facebook.com/userid_here/picture
Replace userid_here with the ID of the user whose profile image you wish to retrieve. HTTPS is also supported.
Implementation:
In PHP, employ the file_get_contents function to fetch the image URL:
<code class="php">$image_data = file_get_contents("http://graph.facebook.com/userid_here/picture");</code>
Additional Notes:
The above is the detailed content of How to Fetch a User\'s Facebook Profile Image without Authorization?. For more information, please follow other related articles on the PHP Chinese website!