数组中的朋友的名字

时间:2012-10-26 12:09:02

标签: facebook

我需要为学校制作一个Facebook应用程序。 是否可以检索登录的人的姓名并将其放入数组中? 我正在使用actionscript 3.0制作这个应用程序

1 个答案:

答案 0 :(得分:-1)

使用Facebook PHP-SDK

$facebook = new Facebook(array(
                'appId' => 'Your_app_id',
                'secret' => 'Your_app_Secret',
                'cookie' => true,
            ));


    // Getting friends list
    $friends = $facebook->api('/me/friends');


    foreach ($friends as $friends1) {
      foreach ($friends1 as $friend) {

         $id = $friend['id'];
         $name = $friend['name'];
      }
   }