I will describe about the Facebook free api to
get “LIKE and SHARES” count. Have you seen any website which shows there fb
likes and shares on front webpage? It's very easy and free of cost. I think it
is useful for every site which need popularity on facebook or Do marketing
through Facebook.
Facebook saves likes and shares of your url in a table named link_stat.
Please go through with below link :
https://api.facebook.com/method/fql.query?query=SELECT url,
share_count, like_count, comment_count, total_count, click_count FROM link_stat
where url=@url
Note:- @url is your url name.
When you pass above url into below code it will return result as Xml.
WebClient web = new WebClient();
string url = string.Format("https://api.facebook.com/method/fql.query?query=SELECT url, share_count, like_count, comment_count, total_count, click_count FROM link_stat where url='" + urltxt + "'");
string response = web.DownloadString(url);
DataSet ds = new DataSet();
StringReader stringReader = new StringReader(response)
{
ds = new DataSet();
ds.ReadXml(stringReader);
}
After that you can read xml and push into Dataset. Now I have all the details in
a dataset .You can easily show these data from any control(like label or any div
etc.) on your website.

Join the conversation! Your thoughts help the community grow.