title: How to use access token with PHP SDK and retrieve user_activities parameter using fql?
body: <p>I was wondering how to use access token obtained by the getAccessToken() in PHP SDK
  Following is my code snippet trying to display user email id as well as user activities :
  When I run this code emAIL AND USER ACTIVITIES are blank how do I fix this?</p>
  
  <pre><code>      &lt;?php
  
  
  
      require '/home/vespanve/public_html/facebook-php-sdk/src/facebook.php';
  
      $facebook = new Facebook(array(
        'appId'  =&gt; '39653698mmmmm448',
        'secret' =&gt; 'd7681299469mmmmmmmmmmmmm',
      ));
  
      $config = array(
          'appId' =&gt; '39653698mmmmm448',
          'secret' =&gt; 'd7681299469mmmmmmmmmmmmm',
        );
  
        $facebook = new Facebook($config);
        $user_id = $facebook-&gt;getUser();
      $access_token = $facebook-&gt;getAccessToken();
      $facebook-&gt;setAccessToken($access_token);
  
      ?&gt;
      &lt;html&gt;
        &lt;head&gt;&lt;/head&gt;
        &lt;body&gt;
  
        &lt;?
          if($user_id) {
  
  // We have a user ID, so probably a logged in user.
  // If not, we'll get an exception, which we handle below.
            try {
  
              $fql = 'SELECT name from user where uid = ' . $user_id;
          $fqlmail = 'SELECT email from user where uid = ' . $user_id;
          $fqlact = 'SELECT user_activities from user where uid = ' . $user_id;
              $ret_obj = $facebook-&gt;api(array(
                                         'method' =&gt; 'fql.query',
                                         'query' =&gt; $fql,
                                       ));
          $ret_obj2 = $facebook-&gt;api(array(
                                         'method' =&gt; 'fql.query',
                        'access_token' =&gt; $cookie['access_token'],
                                        'query' =&gt; $fqlmail,
                                       ));
          $ret_obj3 = $facebook-&gt;api(array(
                                         'method' =&gt; 'fql.query',
                        'access_token' =&gt; $cookie['access_token'],
                                        'query' =&gt; $fqlact,
                                       ));
  
              // FQL queries return the results in an array, so we have
              //  to get the user's name from the first element in the array.
              echo '&lt;pre&gt;Name: ' . $ret_obj[0]['name'] . '&lt;/pre&gt;';
          echo '&lt;pre&gt;Email: ' . $ret_obj2[0]['email'] . '&lt;/pre&gt;';
          echo '&lt;pre&gt;Activities: ' . $ret_obj3[0]['user_activities'] . '&lt;/pre&gt;';
          $facebook-&gt;destroySession();
  
  
  
            } catch(FacebookApiException $e) {
              // If the user is logged out, you can have a 
              // user ID even though the access token is invalid.
              // In this case, we'll get an exception, so we'll
              // just ask the user to login again here.
              $login_url = $facebook-&gt;getLoginUrl(); 
              echo 'Please &lt;a href="' . $login_url . '"&gt;login.&lt;/a&gt;';
              error_log($e-&gt;getType());
              error_log($e-&gt;getMessage());
            }   
          } else {
  
  // No user, so print a link for the user to login
            $login_url = $facebook-&gt;getLoginUrl();
            echo 'Please &lt;a href="' . $login_url . '"&gt;login.&lt;/a&gt;';
  
          }
      ?&gt;
  
        &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>