Facebook Graph API - Finding a users top friends

后端 未结 6 1961
不思量自难忘°
不思量自难忘° 2020-12-13 03:08

I am writing a android app that will pull in a list of all the users friends so they can tag them in the photo but displaying a large box of the friends with their photo ins

6条回答
  •  孤街浪徒
    2020-12-13 03:20

    The other way of doing it is, make a Graph API request for the status messages posted by the user, the friends who have commented or liked his status are the ones with whom he/she interacts the most, doing this is pretty simple, you can use this:

        $statuses = $facebook->api('/me/statuses');
    
        foreach($statuses['data'] as $status){
        // processing likes array for calculating fanbase. 
    
                foreach($status['likes']['data'] as $likesData){
                    $frid = $likesData['id']; 
                    $frname = $likesData['name']; 
                    $friendArray[$frid] = $frname;
                }
    
             foreach($status['comments']['data'] as $comArray){
             // processing comments array for calculating fanbase
                        $frid = $comArray['from']['id'];
                        $frname = $comArray['from']['name'];
        }
    }
    

    keep counters as per your choice, and it will be done.

提交回复
热议问题