title: Facebook API how to get User Pages
body: <p>I am using the following code to grab info for the Facebook user.</p>
  
  <p>Is there a way to get the user Pages (if the user has one or more Facebook Pages) and the IDs of these pages?</p>
  
  <pre><code>$user = $_POST['uid']; //the returned user ID from Facebook
  $key  = $_POST['usid']; //the returned session ID from Facebook
  $accesstoken = $_POST['accesstoken']; //the returned accesstoken from Facebook
  $image = "http://graph.facebook.com/" .$user ."/picture?type=large"; //Facebook Profile Picture
  $name = json_decode(file_get_contents('https://graph.facebook.com/' . $user))-&gt;name; //Name of the user account on Facebook
  $link = json_decode(file_get_contents('https://graph.facebook.com/' . $user))-&gt;link; //Link of the user profile on Facebook
  $gender = json_decode(file_get_contents('https://graph.facebook.com/' . $user))-&gt;gender; //Gender of the user on Facebook
  $locale = json_decode(file_get_contents('https://graph.facebook.com/' . $user))-&gt;locale; //Location of the user on Facebook
  $url = "https://graph.facebook.com/". $user ."/feed?limit=1&amp;access_token=".$accesstoken; //We get the latest status update on the Facebook Wall
  $json = file_get_contents($url);
  $jsonData = json_decode($json);
  foreach($jsonData-&gt;data as $val) {
  if($val-&gt;from-&gt;id == $user) {
  $statusmessage = $val-&gt;message; //Finally we got the latest status update if there is one on The Facebook Wall
  break;
  }
  }
  </code></pre>