-
Webseiten Hosting/Server Referenzen Kontakt/Impressum

How to check if a user likes my page on facebook without any API-request

<< Back to overview / Zurück zur Übersicht

If you embed your facebook app in your page (via a tabbed canvas), facebook will provide basic information to your app.
This data contains among other things the information if the current user likes your page. It can be accessed this way (PHP example):
$config=array(
'appId'=>$GLOBALS['_appid'],
'secret'=>$GLOBALS['_appsecret']
);

$signed_request=$_REQUEST['signed_request'];
list($encoded_sig,$payload)=explode('.',$signed_request,2);
$data=json_decode(base64_decode(strtr($payload,'-_','+/')),true);
$app_data=isset($data['app_data'])?$data['app_data']:'';

$pageid=$data['page']['id'];
$access_admin=$data['page']['admin']==1;
$has_liked=$data['page']['liked']==1;
Without any warranty - use this information at your own risk.
Created at 2011-11-15
Tags: facebook app tab find out if user likes my page friend visitor

Seite zuletzt geändert am: 18.11.2011