How can I display the users profile pic using the facebook graph api?
To display a user's profile picture using the Facebook Graph API in PHP, you can make a GET request to the /{user-id}/picture endpoint.
To display a user's profile picture using the Facebook Graph API in PHP, you can make a GET request to the /{user-id}/picture endpoint, where {user-id} is the ID of the user whose profile picture you want to display.
You can include the access_token parameter in the request, which will allow you to access the user's profile picture.
You can use the following code snippet to make the request:
Example of displaying the user's profile picture with the Facebook Graph API in PHP
<?php
$user_id = "{user-id}";
$access_token = "{access-token}";
$url = "https://graph.facebook.com/$user_id/picture?access_token=$access_token";
// The Facebook Graph API returns a 302 redirect to the actual image URL.
// Browsers handle this automatically, so you can output the <img> tag directly.
echo "<img src='$url' alt='Profile Picture'>";
?>Note that you need a valid Access Token to access the user's profile picture. You can generate a test token using the Graph API Explorer and ensure the public_profile permission is granted. Also, verify that the user's privacy settings allow the application to access their profile picture.