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, 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.

Watch a course Learn object oriented PHP

You can use the following code snippet to make the request:

<?php

$user_id = "{user-id}";
$access_token = "{access-token}";

$url = "https://graph.facebook.com/$user_id/picture?access_token=$access_token";
$headers = get_headers($url, 1);

// Check if the image is available
if (strpos($headers[0], '200') !== false) {
    echo "<img src='$url' alt='Profile Picture'>";
} else {
    echo "Profile picture not found.";
}

Note that you need to have an Access token to access the user's profile picture. Also, you need to check if the user has set the privacy settings to allow the application to access his/her profile picture.