title: Facebook api php - Check if user likes the page
body: <p>trying to check if the user likes the facebook with php. Checked similar questions they seem to be outdated. The application has permissions for user_likes. Making loging with javascript. Tryed both solutions in php/js all return empty result.</p>
  
  <pre><code>$fb = new Facebook\Facebook([
      'app_id' =&gt; '000',
      'app_secret' =&gt; '000',
      'default_graph_version' =&gt; 'v2.4',
  ]);
  
  $helper = $fb-&gt;getJavaScriptHelper();
  
  try {
      $accessToken = $helper-&gt;getAccessToken();
  } catch(Facebook\Exceptions\FacebookResponseException $e) {
      echo 'Graph returned an error: ' . $e-&gt;getMessage();
      exit;
  } catch(Facebook\Exceptions\FacebookSDKException $e) {
      echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
      exit;
  }
  
  $response = $fb-&gt;get('/me/likes/40796308305', $accessToken);
  
  if ( $_GET['debug']=='1' ) {    
      echo("&lt;pre&gt;");
      print_r($response);
      echo("&lt;/pre&gt;");
  }
  </code></pre>
  
  <p>The response I get looks like this:</p>
  
  <pre><code>Facebook\FacebookResponse Object
  (
      [httpStatusCode:protected] =&gt; 200
      [headers:protected] =&gt; Array
          (
              [Access-Control-Allow-Origin] =&gt; *
              [Content-Type] =&gt; application/json; charset=UTF-8
              [X-FB-Trace-ID] =&gt; AJjNMCquJMO
              [X-FB-Rev] =&gt; 2105600
              [ETag] =&gt; "1050253aec7b29caff644806927dabfa81406eee"
              [Pragma] =&gt; no-cache
              [Cache-Control] =&gt; private, no-cache, no-store, must-revalidate
              [Facebook-API-Version] =&gt; v2.4
              [Expires] =&gt; Sat, 01 Jan 2000 00:00:00 GMT
              [Vary] =&gt; Accept-Encoding
              [X-FB-Debug] =&gt; 6+GDFRqzzKDCdxTWVr9KKZ3Bbo57jGhTvmTHFmtarBr8AoQKY/5ymi4yXp1Kzb3zVYcs+AJKP2czljJvggCF6Q==
              [Date] =&gt; Wed, 23 Dec 2015 11:53:40 GMT
              [Connection] =&gt; keep-alive
              [Content-Length] =&gt; 11
          )
  
      [body:protected] =&gt; {"data":[]}
      [decodedBody:protected] =&gt; Array
          (
              [data] =&gt; Array
                  (
                  )
  
          )
  
      [request:protected] =&gt; Facebook\FacebookRequest Object
          (
              [app:protected] =&gt; Facebook\FacebookApp Object
                  (
                      [id:protected] =&gt; 889383307815047
                      [secret:protected] =&gt; 0892e37a317e97748bab6f64ad984b6e
                  )
  
              [accessToken:protected] =&gt; CAAMo47AhqIcBAD9wcLEXslcyGW1wYLidu1GNmlSok2ZAgdZAU3IOjSKBhplSgFz8c8ZBGoyRGVHZB4qC1vwOeNozSV8M5WcgipyfPxy7RimPaZBhDgDnzG692BLj7dDZBgeZB4h7sgNr4kcjAnD4VzQE6wGZCZBpfijZBdZBfuCAww9ZCvxESMwJGRQZCeFSHKw8DORQ7m6mPPc2UjLq2TdqESZAZCv
              [method:protected] =&gt; GET
              [endpoint:protected] =&gt; /me/likes/40796308305
              [headers:protected] =&gt; Array
                  (
                      [Content-Type] =&gt; application/x-www-form-urlencoded
                  )
  
              [params:protected] =&gt; Array
                  (
                  )
  
              [files:protected] =&gt; Array
                  (
                  )
  
              [eTag:protected] =&gt; 
              [graphVersion:protected] =&gt; v2.4
          )
  
      [thrownException:protected] =&gt; 
  )
  </code></pre>