title: Facebook api: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request with
body: <p>I have been looking on stack and the facebook documentation on how to do a facebook api call to get a pages status messages.</p>
  
  <p>So Far I have this:</p>
  
  <pre><code>$url = "https://graph.facebook.com/dogfishheadbeer/statuses?fields=message,updated_time&amp;limit=5";
  $url_with_token = $url . "?access_token={$access_token}";
  $facebookData = json_decode(file_get_contents($url_with_token));
  </code></pre>
  
  <p>I am not sure how to get my access token though. I went to the facebook api explorer here:</p>
  
  <p><a href="https://developers.facebook.com/tools/explorer/" rel="nofollow">https://developers.facebook.com/tools/explorer/</a></p>
  
  <p>and I clicked "Gett acces token" but hwen used in my php cpde I get this error:</p>
  
  <pre><code>Warning: file_get_contents(https://graph.facebook.com/dogfishheadbeer/statuses?fields=message,updated_time&amp;limit=5?access_token=myAccesToken) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
  </code></pre>
  
  <p>I also read acces tokens expire and my website needs to be able to refresh them. I am a bit lost on what to try next, any help would be appreciated. </p>