How to determine if Facebook uses “Some Page”

Is there a way to determine if a Facebook user likes some page with the proposed Facebook APIs?

UPDATE

I have been trying to get this to work through the PHP graphics API for a while with this code.

$fbconfig['appid'] = '***';
$fbconfig['api'] = '***';
$fbconfig['secret'] = '***';

try {
    include_once "facebook.php";
} catch(Exception $o) {
    echo '<pre>';
    print_r($o);
    echo '</pre>';
}

$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
  'cookie' => true,
));

$session = $facebook->getSession();
$me = null;

if ($session) {
    try {
        $uid = $facebook->getUser();
        $me = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        d($e);
    }
}

if($me) {
    try {
        $likes = $facebook->api('/me/likes');
    } catch(Exception $o) {
        d($o);
    }
}

However, the session is always zero, although I logged in.

Apparently, the above code is only good for Facebook Connect “Canvas” applications, I call this code from the FBML tab on the Facebook page page via an AJAX call to my server.

I am not very familiar with all the terminology of Facebook development.

How can I make the current user like me in my situation?

+5
4

- API.

PHP:

<?php
$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"] : '';
$_REQUEST["fb_page_id"] = $data["page"]["id"];
$access_admin = $data["page"]["admin"] == 1;
$has_liked = $data["page"]["liked"] == 1;
?>

$has_liked, , .

<?php if($has_liked) : ?>
fan-specifc
<?php else : ?>
for non-fans only
<?php endif; ?>

<fb:visible-to-connection>
fan-specific content
<fb:else>
for non-fans only
</fb:else>
</fb:visible-to-connection>

, - .

+11

API, , , post/feed.

FQL apis.

+2

FQL. , FQL. http://developers.facebook.com/docs/reference/rest/fql.query

SELECT user_id FROM, WHERE object_id = "fb_id"

but replace fb_id with the id of the object you want to find out how many people like.

0
source

To please the user, you need permission user_likes.
Just add permission to your fb:login-buttonperms attribute , and the next time the user logs in, they will be asked to grant your application access to the new permission.

0
source

All Articles