Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For the breakdown between likes, shares and comments (which are added up and used as the "likes" number on the likes button, you're better off using FQL.</p> <p>If you use OG, something like <a href="http://graph.facebook.com/http://example.com" rel="nofollow">http://graph.facebook.com/http://example.com</a> will show you:</p> <pre><code>{ "id": "http://example.com", "shares": 3 } </code></pre> <p>... as you've noted above. If you use FQL, you can get the breakdown of each.</p> <pre><code>&lt;?php // require the php sdk require_once 'facebook-php-sdk/src/facebook.php'; // Create our Application instance. $facebook = new Facebook(array( 'appId' =&gt; 'YOUR_APP_ID', 'secret' =&gt; 'YOUR_APP_SECRET', 'cookie' =&gt; true, )); $external_result = $facebook-&gt;api(array( 'method' =&gt; 'fql.query', 'query' =&gt; 'SELECT share_count, like_count, comment_count, total_count, click_count FROM link_stat WHERE url="http://example.com";' )); echo '&lt;li&gt;'.number_format($external_result[0]['like_count']).' likes, '.number_format($external_result[0]['share_count']).' shares'; echo '&lt;pre&gt;'; print_r($external_result); echo '&lt;/pre&gt;'; ?&gt; </code></pre> <p>This will display something on-screen like:</p> <pre><code>* 1 likes, 2 shares Array ( [0] =&gt; Array ( [share_count] =&gt; 2 [like_count] =&gt; 1 [comment_count] =&gt; 0 [total_count] =&gt; 3 [click_count] =&gt; 0 ) ) </code></pre> <p>Also, SA now has a Facebook-specific site that may be helpful to you. :) facebook.stackoverflow.com</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload