Facebook Likes/Shares Checker for a Webpage

Facebook integration is by now ‘a must’ for websites. By providing tools to share or like your site to Facebook, it gives your site a lot more opportunity to get read and seen by the 500 million ++ users of Facebook. Facebook has developed several simple to use API’s for this which can be found here: http://developers.facebook.com/docs/guides/web.

Statistics can be monitored in http://www.facebook.com/insights, however the data presented is far from complete. For example, something as simple as monitoring how many people has “shared” or “liked” your website is not easily determined. Fortunately there’s a handy link for checking the number of Facebook “likes” or “shares” of a given Web Page URL also provided by Facebook but not as known:

http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.eacomm.com

The above query will return an XML document in the following format:

<?xml version=”1.0″ encoding=”UTF-8″?>

<links_getStats_response xmlns=”http://api.facebook.com/1.0/” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd” list=”true”>

<link_stat>

<url>http://www.eacomm.com</url>

<share_count>3</share_count>

<like_count>3</like_count>

<comment_count>13</comment_count>

<total_count>19</total_count>

<click_count>0</click_count>

<normalized_url>http://www.eacomm.com/</normalized_url>

</link_stat>

</links_getStats_response>

This can then be parsed by a simple application to store the statistics in a database.

For example in PHP you can use the simlexml_load_file to parse this. Below is a very simple code (admittedly not very elegant, but it works) to do this:

$url = “http://www.eacomm.com”;
$xml = simplexml_load_file(“http://api.facebook.com/restserver.php?method=links.getStats&urls=$url”);
$child=$xml->children();
$child2=$child->children();
$shares=$child2->share_count;
$likes=$child2->like_count;
$comments=$child2->comment_count;
$total=$child2->total_count;
$clicks=$child2->click_count;

You can now store the shares, likes, etc. in a database and monitor for yourself how your website is performing in Facebook.

Below is a form to check if your site has been ‘shared’ in Facebook:

http://www.eacomm.com/fblikecheck.php

Facebook Likes/Shares Checker:

Enter the Web Page you want to check:

One thought on “Facebook Likes/Shares Checker for a Webpage

  1. Facebook Likes

    I’ve learn several excellent stuff here. Certainly value bookmarking for revisiting. I wonder how so much effort you put to make this sort of wonderful informative website.

Leave a Reply

Your email address will not be published. Required fields are marked *