Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get FB User Profile
* fetch profile of given fb's user id. fields are optional.
function getFbProfile($userId, array $fields = [])
$BASE_URL = '';
// fetch default fields if no fields passed
if (empty($fields)) {
$fields = [
$endpoint = sprintf("%s/%s?fields=%s&access_token=%s",
implode(',', $fields),
return json_decode(file_get_contents($endpoint), true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment