title: How can I retrieve the users friendslist and display?
body: <p>(Sorry for my english) </p>
  
  <p>I am developing <a href="http://livescoreapp.azurewebsites.net/" rel="nofollow">a web application</a> with php and Facebook php sdk 4.0. I'm using the FacebookRedirectLoginHelper.php to let the authorize access to their information. I take their facebook-id and store it in the database table Users {int UserID FK, nvarchar(max) UserName, nvarchar(max) facebook-id}.  I want to make a list of their facebookfriends who are using the web application. How can this be possible? I can't just change the row:</p>
  
  <p><strong>new FacebookRequest( $session, 'GET', '/me' );</strong> </p>
  
  <p>to </p>
  
  <p><strong>new FacebookRequest( $session, 'GET', '/me/friends' );</strong></p>
  
  <p>?</p>
  
  <pre><code>require_once( 'Facebook/FacebookSession.php' );
  require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
  require_once( 'Facebook/FacebookRequest.php' );
  require_once( 'Facebook/FacebookResponse.php' );
  require_once( 'Facebook/FacebookSDKException.php' );
  require_once( 'Facebook/FacebookRequestException.php' );
  require_once( 'Facebook/FacebookAuthorizationException.php' );
  require_once( 'Facebook/GraphObject.php' );
  
  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  use Facebook\FacebookRequest;
  use Facebook\FacebookResponse;
  use Facebook\FacebookSDKException;
  use Facebook\FacebookRequestException;
  use Facebook\FacebookAuthorizationException;
  use Facebook\GraphObject;
  
  // init app with app id (APPID) and secret (SECRET)
  FacebookSession::setDefaultApplication('XXX','XXX');
  
  // login helper with redirect_uri
  $helper = new FacebookRedirectLoginHelper( 'http://livescoreapp.azurewebsites.net/' );
  
  try {
    $session = $helper-&gt;getSessionFromRedirect();
  } catch( FacebookRequestException $ex ) {
    // When Facebook returns an error
  } catch( Exception $ex ) {
    // When validation fails or other local issues
  }
  
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8" /&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
    &lt;h1&gt;Welcome&lt;/h1&gt;
  &lt;?php
        if($conn === false)
      {
          die(print_r(sqlsrv_errors()));
      }
      else //Connection to database is ok. 
      {
      // see if we have a session
          if ( isset( $session ) )
          {
            // graph api request for user data
            $request = new FacebookRequest( $session, 'GET', '/me' );
            $response = $request-&gt;execute();
            // get response
            $graphObject = $response-&gt;getGraphObject();
  
            // print data
            echo  '&lt;pre&gt;' . print_r( $graphObject, 1 ) . '&lt;/pre&gt;';
  
              $fb_Id = $graphObject-&gt;getProperty('id');
              $fb_Name = $graphObject-&gt;getProperty('name');
              echo "HEY &lt;a href='" . $fb_link . "'&gt;" . $fb_Name . "&lt;/a&gt;";
              echo "&lt;br&gt; Your fb-id: " .  $fb_Id; 
  
            //  if(CheckIfUserExistsInDatabase($fb_Id, $conn) == false)
            //  {
            //       InsertNewUser($conn,  $fb_Id,  $fb_Name); 
             // }
  
          } 
          else {
            // show login url
            echo '&lt;a href="' . $helper-&gt;getLoginUrl() . '"&gt;Login&lt;/a&gt;';
          }
      }
      ?&gt; 
  </code></pre>
  
  <p>What this code prints out: </p>
  
  <p><img src="https://dl.dropboxusercontent.com/u/19434101/Pictures/welcomeUser.PNG" alt="a busy cat">
  !</p>