Hello
I getting current user friends list by php api of facebook.
can you suggest me what is missing.LINK

<?php
require 'facebook.php';

$facebook = new Facebook(array(
    'appId' => 'removed',
    'secret' => 'removed',
));

if($facebook->getUser() == 0){
    $login = $facebook->getLoginUrl();
    echo "<a href= '$login'>Login with Facebook</a>";
}
else{

        $user_profile = $facebook->api('/me');
        $user_friends = $facebook->api('/me/friends');
        $access_token = $facebook->getAccessToken();


    echo "<pre>";
    print_r($user_profile);
    echo "</pre>";
    echo "<br/>";


    echo "<pre>";
    print_r($user_friends);            //Given NULL Value
    echo "</pre>";
}
?>

can you suggest me what is missing

What's not working?

print_r($user_friends); given null
i want his friend list data in array

No one can idea about this.

What's the output for /me ?

'/me' given array of current user data who is login.(eg.firstname,lastname,id etc.)

I have also given permission of [permission] => user_friends & [permission] => read_friendlists

Given solution : Facebook Faq

Version Information:

In v2.0 of the API, /me/friends returns friends who also have logged into the app.

Apps created on or after April 30th 2014 must use Graph API v2.0; they're not able to call Graph API v1.0.

For apps which existed before April 30th, these apps can call either Graph API v2.0 or Graph API v1.0, but Graph API v1.0 will be deprecated on April 30th 2015.

Note that if a user logs into an app via v2.0, and you call /v1.0/me/friends, this will still only return app-using friends.

If you want to access non-app-using friends in the case where you want to let your users tag people in stories you publish to Facebook, you can use the /me/taggable_friends API.

how to set ermission of [permission] => user_friends & [permission] => read_friendlists in cakephp . pls help me urgent

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.