Facebook: Get friend’s name and custom size profile picture

17 12

I’ve code application for Facebook just for fun but need to access friend name and profile picture. But when google, graph api request /me/friends not work anymore, because on 2.0 and higher version of open SDK it just get all friends who had been login to your app before. So it not usable for my application idea.
After that, I found Facebook SDK provide new way to get friends information is taggable_friends. It is ok for developer, tester for this app, but if you design for user, remember submit review to Facebook for permission approved.
On my case, Graph api:
GET request: me/taggable_friends?fields=picture.width(300).height(300),name
On graph api explorer, choice application firsts before test. You can change with and height for small or large picture.


$fb = new Facebook\Facebook([
‘app_id’ => APP_ID,
‘app_secret’ => APP_SECRET,
‘default_graph_version’ => ‘v2.4’,

try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(‘me/taggable_friends?fields=picture.width(300).height(300),name’, ACCESS_TOKEN);
} catch (Facebook\Exceptions\FacebookResponseException $e) {
echo ‘Graph returned an error: ‘ . $e->getMessage();
} catch (Facebook\Exceptions\FacebookSDKException $e) {
echo ‘Facebook SDK returned an error: ‘ . $e->getMessage();

$fr = $response->getGraphEdge();

foreach ($fr as $f) {

Have good time with code ! ^^

Chào bạn, mình là Duy, hiện đang làm việc và lập trình Freelance. Mình viết blog này để ghi nhớ những điều học hỏi được cũng như chia sẻ kinh nghiệm kiếm tiền online và lập trình của mình. Rất mong được sự góp ý của tất cả các bạn.

Leave a Reply

Your email address will not be published. Required fields are marked *