title: How to get an email of user using php facebook sdk
body: <p>i am doing login with facebook using php facebook graph api,here after login with facebook I got details of user like name,id,location,link. etc. But I can not get Email Id of user. I refer lots of examples like this but I cannot understand how to do this in my code.</p>
  
  <p>Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  /* INCLUSION OF LIBRARY FILEs*/
   require_once( 'lib/Facebook/FacebookSession.php');
   require_once( 'lib/Facebook/FacebookRequest.php' );
   require_once( 'lib/Facebook/FacebookResponse.php' );
   require_once( 'lib/Facebook/FacebookSDKException.php' );
   require_once( 'lib/Facebook/FacebookRequestException.php' );
   require_once( 'lib/Facebook/FacebookRedirectLoginHelper.php');
   require_once( 'lib/Facebook/FacebookAuthorizationException.php' );
   require_once( 'lib/Facebook/GraphObject.php' );
   require_once( 'lib/Facebook/GraphUser.php' );
   require_once( 'lib/Facebook/GraphSessionInfo.php' );
   require_once( 'lib/Facebook/Entities/AccessToken.php');
   require_once( 'lib/Facebook/HttpClients/FacebookCurl.php' );
   require_once( 'lib/Facebook/HttpClients/FacebookHttpable.php');
   require_once( 'lib/Facebook/HttpClients/FacebookCurlHttpClient.php');
  
  /* USE NAMESPACES */
   
   use Facebook\FacebookSession;
   use Facebook\FacebookRedirectLoginHelper;
   use Facebook\FacebookRequest;
   use Facebook\FacebookResponse;
   use Facebook\FacebookSDKException;
   use Facebook\FacebookRequestException;
   use Facebook\FacebookAuthorizationException;
   use Facebook\GraphObject;
   use Facebook\GraphUser;
   use Facebook\GraphSessionInfo;
   use Facebook\FacebookHttpable;
   use Facebook\FacebookCurlHttpClient;
   use Facebook\FacebookCurl;
  
  /*PROCESS*/
   session_start();
   
    $app_id = '389605751141082';
    $app_secret = 'a59a6fb216eafe5e3accc7b95f53c3bc';
    $redirect_url='http://parshwatax.com/november/facebook/test.php';
    
   
    FacebookSession::setDefaultApplication($app_id,$app_secret);
    $helper = new FacebookRedirectLoginHelper($redirect_url);
    $sess = $helper-&gt;getSessionFromRedirect();
        
  if(isset($sess)){
                  $request = new FacebookRequest($sess, 'GET', '/me');
   $response = $request-&gt;execute();
                 $graph = $response-&gt;getGraphObject(GraphUser::className());
             
                  $fname= $graph-&gt;getFirstName();
                 echo "hi $fname";
                   $lname= $graph-&gt;getLastName();
                 echo "$lname"; 
                  $id= $graph-&gt;getId();
                 echo "$id";
                 $link= $graph-&gt;getLink();
                 echo "$link";
                $mail= $graph-&gt;getEmail();
                 echo "$mail";
  
  require_once("connection.php");
  $q="select * from `myuser` where `Email`='$mail'";
  $r=mysql_query($q);
  $row=mysql_fetch_assoc($r);
  $uid=$row['Userid'];
  echo $uid;
  echo "Your are successfully login &lt;a href='http://parshwatax.com/november/fblogincheck.php?a=$uid'&gt;click here&lt;/a&gt; to enjoy swapping...!";
  }
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is main part of page which is not clear to me, but I only need email id.</p>