title: Using the Facebook Graph APIs PHP library
body: <p>I am using the PHP library for the Graph API (<a href="http://github.com/facebook/php-sdk" rel="nofollow noreferrer">http://github.com/facebook/php-sdk</a>) but am a bit confused about how it is all working (or not).</p>
  
  <p>I just want to authenticate the user and get the user ID back. What I really want to know is what to do once the user has logged in to Facebook and returned to my site. There is data called 'session' in the URL. Does this need to be stored in order to continually get the user ID? It is really not apparent, to me, from the samples or (lack of) documentation.</p>
  
  <p>Also, would it be easier to just cut out the PHP library altogether and just handle the reponse myself, storing it in a session variable. If i were to do this, what is the best method of getting/extracting the current users ID?</p>
  
  <p>Edit:</p>
  
  <p>Currently, i have copied the facebook.php file and the example.php file over from GitHub, and only changed the application name and secret in example.php. It is not storing a cookie and is saying 'You are not connected'. However, when I <code>print_r($session);</code> it works (but only if the url contains the session data).</p>
  
  <p>Has anyone else experienced problems like this? Is it possible that running on localhost is causing this?</p>
  
  <p>Edit:</p>
  
  <p>I uploaded exactly the same two files to a host and it worked perfectly. It stored the cookie and showed all information it should. It is most likely that running on localhost is causing the problems. I have changed the settings under the Connect tab on the Facebook Developer application but still no luck.</p>
  
  <p>Anyone know how to do this from localhost or what i am doing wrong?</p>