title: Check fan page like to access application in Facebook
body: <p>I'm currently trying to develop a facebook app which I want only fans to access. So, to check if a user liked the fan page I linked to the game, I'm using this code:</p>
  
  <pre><code>&lt;?php
  $our_page_id = 'page_id';
  $user_is_fan = false;
  $likes = $facebook-&gt;api( '/me/likes?fields=id' );
  foreach( $likes['data'] as $page ) {
      if( $page['id'] === $our_page_id ) {
          $user_is_fan = true;
                  break;
      }
  }
  
  echo "likes:" . $likes;
  echo "fan:".$user_is_fan;?&gt;
  </code></pre>
  
  <p>And this is my like button which I generated through the documentation:</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
      &lt;script&gt;(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&amp;appId=14XXXX";
          fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
      &lt;/script&gt;
  &lt;/div&gt;
  &lt;div class="fb-like" data-href="http://www.facebook.com/pages/xx/xx?fref=ts" data-send="false" data-width="450" data-show-faces="true"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I'm currently getting an error about an invalid OAuth token but when I remove the part where I check for facebook likes, it works okay. Also, I tried the FB.Event.subscribe('edge.create') function to try to check for events when the like button is clicked but it didn't show the alert.</p>
  
  <p>Earlier, this worked like a charm however now, no matter how much I click the like button, $user_is_fan returns false. Did I do something wrong here? Or am I implementing this wrongly?</p>
  
  <p>Is there a different and effective way of checking for likes in facebook? Help please.
  NOTE: I'm using the Facebook PHP SDK.</p>