title: how to get Facebook country and city using php sdk
body: <p>Hello i'm struggling with getting the location of an user when he logs on the website. I want to get city and country. Here is my code.</p>
  
  <pre><code>require 'src/facebook.php';  // Include facebook SDK file
    // Include functions
  $facebook = new Facebook(array(
    'appId'  =&gt; '446287188809548',   // Facebook App ID 
    'secret' =&gt; '5210aae00c4f11eca8451a9da9be4aaf',  // Facebook App Secret
    'cookie' =&gt; true, 
  ));
  $user = $facebook-&gt;getUser();
  if ($user) {
    try {
      $user_profile = $facebook-&gt;api('/me');
          $fbid = $user_profile['id'];                 // To Get Facebook ID
          $fbuname = $user_profile['username'];  // To Get Facebook Username
          $fbfullname = $user_profile['name']; // To Get Facebook full name
            $femail = $user_profile['email'];    // To Get Facebook email ID
  
      //       checkuser($fbid,$fbuname,$fbfullname,$femail);    // To update local DB
    } catch (FacebookApiException $e) {
      error_log($e);
     $user = null;
    }
  }
  if ($user) {
    $logoutUrl = $facebook-&gt;getLogoutUrl(array(
           'next' =&gt; 'http://websoftit.ro/lackoflove/logout.php',  // Logout URL full path
          ));
  } else {
   $loginUrl = $facebook-&gt;getLoginUrl(array(
          'scope'     =&gt; 'email', // Permissions to request from the user
          ));
  }
  </code></pre>