Note that there are some explanatory texts on larger screens.

plurals
  1. POcant get user id facebook php
    primarykey
    data
    text
    <p>I got crazy to fix it and i have no solution for this. </p> <p>I tried to put permissions - its not working.<br> The kidding thing here is when I try to get my profile photo via OpenGraph it is working fine<br> but when i try this with another account it is not working and I get <code>$user = NULL (0)</code></p> <p>Please try to fix my code, I am a noob in PHP ;)</p> <p>b.t.w: Where do I need to go to find the access token?</p> <pre><code>&lt;? ob_start(); ?&gt; &lt;style&gt; * { direction:rtl; font-family: 'Arial'; } &lt;/style&gt; &lt;? include ("config.php"); //_______________facebook___________________ include 'Facebook.php'; $app_id = "4---------46"; $app_secret = "deed-------7d55"; $facebook = new Facebook(array( 'appId' =&gt; $app_id, 'secret' =&gt; $app_secret, 'cookie' =&gt; false, 'scope' =&gt; 'user_photos' )); &lt;?php $user = $facebook-&gt;getUser(); if ($user &lt;&gt; '0' &amp;&amp; $user &lt;&gt; '') { try { $user_profile = $facebook-&gt;api('/me'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } if ($user &lt;&gt; '0' &amp;&amp; $user &lt;&gt; '') { /*So now we will have a valid user id with a valid oauth access token and so the code will work fine.*/ echo "UserId : " . $user; ?&gt; &lt;img src="https://graph.facebook.com/&lt;?= $user; ?&gt;/picture"&gt; &lt;? $user_profile = $facebook-&gt;api('/me'); } else {/*If user id isn't present just redirect it to login url*/ header("Location:{$facebook-&gt;getLoginUrl(array('req_perms' =&gt; 'email,offline_access'))}"); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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