【问题标题】:Get Like count of a Particular Facebook's page获取特定 Facebook 页面的点赞数
【发布时间】:2014-08-20 18:08:45
【问题描述】:

我在 Facebook 有页面 ID“252079588308065”。我只想使用图形 API 或 FQL 获取此页面的点赞数。

是否可以获取特定页面的点赞数。

请给我一个解决方案

【问题讨论】:

标签: php facebook-graph-api facebook-fql


【解决方案1】:

这是一种使用 Graph API 获取点赞数的方法。

<?php
//The following code returns the Number of likes for any facebook page.

//Page Id of TechRecite.com. Replace it with your page.
$page_id = "138564926335348"; 
$likes = 0; //Initialize the count

//Construct a Facebook URL
$json_url ='https://graph.facebook.com/'.$page_id.'';
$json = file_get_contents($json_url);
$json_output = json_decode($json);

//Extract the likes count from the JSON object
if($json_output->likes){
    $likes = $json_output->likes;
}
//Printing the count
echo 'TechRecite.com has '.$likes.' Facebook Fans';
?>

来源:http://www.techrecite.com/get-facebook-likes-count-of-a-page-using-graph-api/

【讨论】:

    猜你喜欢
    • 2013-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多