简体   繁体   中英

Facebook Graph API: How to read the “likes” of a page?

I try to read the list of people who likes a page, but it looks like it is not possible with the Graph API or FQL. I found lots of entries of people trying it, but nobody found a solution. Is it possible?

Here I get the profile info, I see the field "likes" with the number 200

https://graph.facebook.com/162253007120080/

But when I try to read it, I get an empty data array?

https://graph.facebook.com/162253007120080/likes

Anybody an idea how to handle this?

The resulting data array isn't empty when you go there, it is:

{ "error": { "message": "An access token is required to request this resource.", "type": "OAuthException", "code": 104 } }

Which means you need an access token in order to access that LIKE data..

HI, here you go, streight out my tool box:

<?php
require_once('../library/Facebook.php');
$facebook = new Facebook(array(
    'appId'  => '123456789000000',
    'secret' => 'asdf',
    'cookie' => true,
));
$result = $facebook->api(array(
    'method' => 'fql.query',
    'query' => 'select fan_count from page where page_id = 1234567890;'
));

echo $result[0]['fan_count'];
?>

Call the graph api link. Extract the contents using json_decode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM