title: Canvas app to echo user id back to them. Been trying for hours
body: <p>I got given a code from a friend that displayed the app users birth date on the app canvas.</p>
  
  <p>I have tried to change it in order to echo the users own ID. It works for myself (the creator) and it also works for a friend that i have designated as a developer. But for anyone else it brings up this error:</p>
  
  <pre><code>Warning: file_get_contents(https://graph.facebook.com/me?
  fields=id&amp;access_token=228073413942115|460d2e1ffd0b4cc6b5cb480d53f60d6e)
  [function.file-get-contents]: failed to open stream: HTTP request failed! 
  HTTP/1.0 400 Bad Request in /home/robsdmr/public_html/fb/index.php on line 34
  </code></pre>
  
  <p>The code is as follows.</p>
  
  <pre><code>&lt;?php
  require_once("src/facebook.php");
  
  $app_id = "xxxxxxxxxx";
  $app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
  $canvas_page = "https://apps.facebook.com/roblewtest/" .$app_id;
  
  
  $facebook = new Facebook(array(
  'appId' =&gt; $app_id,
  'secret' =&gt; $app_secret,
  'cookie' =&gt; true,
  ));
  
  $access_token = $facebook-&gt;getAccessToken();
  
  
  $auth_url = "https://www.facebook.com/dialog/oauth?scope=user_id&amp;client_id="
  . $app_id . "&amp;redirect_uri=" . urlencode($canvas_page);
  
  $signed_request = $_REQUEST["signed_request"];
  
  list($encoded_sig, $payload) = explode('.', $signed_request, 2);
  
  $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
  
  if (empty($data["user_id"])) {
  echo("&lt;script&gt; top.location.href='" . $auth_url . "'&lt;/script&gt;");
  } else {
  
  }
  
  $graph_url = "https://graph.facebook.com/me?fields=id&amp;access_token=" . $access_token;
  $result = json_decode(file_get_contents($graph_url));
  
  echo "{$result-&gt;id}"
  
  ?&gt;
  </code></pre>
  
  <p>I am pretty new to this so pointers would be great</p>
  
  <p>I have a feeling that it is the scopes that i am not quite to grips with, but i really need this working.</p>
  
  <p>Thanks a lot guys n gals.</p>
  
  <p>R.</p>