2

如果存在一个Facebook粉丝页面是这样的:Facebook粉丝页面和相关的开放图形对象

https://www.facebook.com/HuffingtonPost 

我想获得喜欢计数调用图形API:这里

https://graph.facebook.com/https://www.facebook.com/HuffingtonPost 

逸岸,我得到:

{ 
    "id": "https://www.facebook.com/HuffingtonPost", 
    "shares": 435839 
} 

,如果我叫

另一方面
https://graph.facebook.com/HuffingtonPost 

我得到一个更详细的输出:

{ 
    "id": "18468761129", 
    "name": "The Huffington Post", 
    "picture": "http://profile.ak.fbcdn.net/hprofile-ak-ash2/188072_18468761129_6398033_s.jpg", 
    "link": "http://www.facebook.com/HuffingtonPost", 
    "likes": 435832, 
    "category": "Website", 
    "website": "http://www.facebook.com/HuffingtonPost", 
    "username": "HuffingtonPost", 
    "company_overview": "The Internet Newspaper\nNews | Blogs | Video | Community", 
    "description": "The Huffington Post - The Internet Newspaper. - Company Overview: The Internet Newspaper News | Blogs | Video | Community | Facebook", 

     [... omissis ...] 

} 

谁能告诉我什么是这两个opengraph对象之间的区别?
股数和喜欢之间也有细微的差异。为什么?

更新:

在最后的日子里图形API返回的对象还的类型,所以我才意识到:

  • 首先API调用返回link_stat类型的对象。
  • 第二个API调用返回一个页面类型对象。

在第一种情况下股数应代表的总和:

  • 数目这个URL
  • 数的这个URL的股的喜欢的(这包括复制/粘贴链接回到Facebook)的
  • 在Facebook上关于此网址的点赞和评论数量
  • 包含此URL作为附件的收件箱邮件的数量。

在第二种情况下像数仅代表自身

五月有人确认我算股份的正确性?

回答

2

欲了解喜欢,分享和评论之间的细分(它们被添加并用作喜欢按钮上的“喜欢”数字,你最好。使用FQL

如果使用OG,像http://graph.facebook.com/http://example.com会告诉你:

{ 
    "id": "http://example.com", 
    "shares": 3 
} 

...如你上面提到如果使用FQL,你可以得到每个细分。

<?php 

// require the php sdk 
require_once 'facebook-php-sdk/src/facebook.php'; 

// Create our Application instance. 
$facebook = new Facebook(array(
    'appId' => 'YOUR_APP_ID', 
    'secret' => 'YOUR_APP_SECRET', 
    'cookie' => true, 
)); 

$external_result = $facebook->api(array(
'method' => 'fql.query', 
'query' => 'SELECT share_count, like_count, comment_count, total_count, click_count FROM link_stat WHERE url="http://example.com";' 
)); 

echo '<li>'.number_format($external_result[0]['like_count']).' likes, '.number_format($external_result[0]['share_count']).' shares'; 

echo '<pre>'; 
print_r($external_result); 
echo '</pre>'; 

?> 

这将显示在屏幕上是这样的:

* 1 likes, 2 shares 
Array 
(
    [0] => Array 
     (
      [share_count] => 2 
      [like_count] => 1 
      [comment_count] => 0 
      [total_count] => 3 
      [click_count] => 0 
     ) 

) 

此外,SA现在有可能对你有帮助的特定的Facebook站点。 :) facebook.stackoverflow.com

+0

您是否尝试在http://www.facebook.com/HuffingtonPost上使用FQL link_stat?您将收到所有设置为0的计数器。 – freedev

+0

当URL以Facebook开头时,我不认为FQL查询按预期工作。他们希望在FB上的页面上使用图形对象。您将获得对象ID并使用:'query'=>'SELECT share_count,like_count,comment_count,total_count,click_count FROM like WHERE object_id =“18468761129”;' – snipe

2

第一个是告诉你有多少喜欢选定的网址。 使用第二个,你将通过页面标识符获得有关页面对象的信息

+0

股票和喜欢数字之间的差异呢? – freedev