Note that there are some explanatory texts on larger screens.

plurals
  1. POSomething wrong, with my facebook graph URL
    text
    copied!<p>I'm obviously doing something wrong when trying to access information from the facebook graph API, here is the code of my page:</p> <p>It fetches everything I need other than the users email address, I understand you need extended permissions which I have requested as seen in my code below.</p> <pre><code>require 'src/facebook.php'; $app_id = "211665122244023"; $canvas_page = "http://apps.facebook.com/midcitymafia/"; $auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&amp;redirect_uri=" . urlencode($canvas_page) . "&amp;scope=email,publish_actions"; $signed_request = $_REQUEST["signed_request"]; list($encoded_sig, $payload) = explode('.', $signed_request, 2); $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); $user_id = $data["user_id"]; if (empty($data["user_id"])) { echo("&lt;script&gt; top.location.href='" . $auth_url . "'&lt;/script&gt;"); } else { $graph1 = file_get_contents ("https://graph.facebook.com/".$user_id . "/?accesstoken=" . $data["oauth_token"]); $graph=json_decode($graph1,true); } $userid = $user_id; $username = $graph['name']; $usergender = $graph['gender']; $useremail = $graph['email']; ?&gt; &lt;br&gt; &lt;?php echo 'ID: ' . $userid; ?&gt; &lt;br&gt; &lt;?php echo 'Name: ' . $username; ?&gt; &lt;br&gt; &lt;?php echo 'Gender: ' . $usergender; ?&gt; &lt;br&gt; &lt;?php echo 'Email: ' . $useremail; ?&gt; </code></pre> <p>I dumped the $graph variable array to see what information it held, this was the result:</p> <pre><code>array(7) { ["id"]=&gt; string(10) "1469088864" ["name"]=&gt; string(10) "Jack Brown" ["first_name"]=&gt; string(4) "Jack" ["last_name"]=&gt; string(5) "Brown" ["username"]=&gt; string(11) "thebestjack" ["gender"]=&gt; string(4) "male" ["locale"]=&gt; string(5) "en_GB" } </code></pre> <p>It doesn't contain the email address so there is obviously a problem with the access token / using the access token to access the graph.</p> <p>When I go to my authorised apps on my Facebook account settings under this app it says "this apps needs your email address "blahblah@yahoo.co.uk"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload