1

When i check whether use has liked my page or not.My app is getting permissions from the user and taking him to my domain page with blank page.

When i remove the code with which i'm using to check like or not,it is working correctly.

This is the code,i'm using to check like or not

    $signed_request = $facebook->getSignedRequest();
    $liked = $signed_request['page']['liked'];

     if ( $liked ) :
      else :
     endif; 

Is this code correct or not?

  • Hello, this has been asked multiple times look to the "related" tab to your right ---->>>> – Mob Nov 08 '11 at 16:30

1 Answers1

2

I do it like that:

$signed_request = $_REQUEST['signed_request'];  

function parsePageSignedRequest() {  
    if (isset($_REQUEST['signed_request'])) {  
      $encoded_sig = null;  
      $payload = null;  
      list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);  
      $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));  
      $data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));  
      return $data;  
    }  
    return false;  
}  


if($signed_request = parsePageSignedRequest()) {  
    if($signed_request->page->liked) {  
     echo "FAN";  
    } else {  
      echo "NO FAN";  
    }  
}  
  • :When i add this,it gets permission and taking me to a blank page.url is my domain linkhttps://xxx.com/apps/myappname/?state=adasdadadadadas –  Nov 08 '11 at 17:03
  • im using this in page tab app. are you using a normal app? if so this would just check if the user likes your app-page. – Wolf Volkmann Nov 08 '11 at 17:09