UPDATE 04/25/2019: Facebook’s Graph API 2.X no longer allows for retrieval of URL likes, shares and comment counts. However, Facebook’s Graph API 3.X DOES allow for retrieval of engagement activity, and I’ve produced a video tutorial and new tutorial. 😉


A few weeks ago, one of my many websites crossed the thousand like club for Facebook likes.

It was a time to celebrate!  Why?

Well, this particular website is a local and somewhat a hyper micro-niche. To be honest, I’m surprised and elated this website has 1000+ likes.

Nevertheless, crossing the 1000+ Facebook like club renders the like button differently.

Instead of being able to now see that there are 1,024 likes, the Facebook like button for this specific website now only shows “1K”.

And because I don’t have a Facebook Fan, Business, or Profile page associated with this website, this adds yet another degree of difficulty in attempting to understand exactly how many likes, shares, and comments exist for website URL, also known as website domain name.

Of course, I Googled a bit to see if there were any quick ideas or methods for retrieving total count for URL likes, shares and comments.

However, most of the answers Googlged were outdated using Facebook’s old REST and FQL API services.

Nevertheless, I ventured over to Facebook for Developers and read the Graph Documentation, which led me to the simple solution I’m about to share with you.

Making Facebook Graph API Call to Retrieve URL Data

The good part about this solution is that you don’t need to be logged into Facebook to use it. Woohoo!

All you need is a web browser, and url appended to the following link:

For example, viewing Texas Hill Country’s Facebook page reveals that they have 972,230 likes. Again, this is their Facebook page and not their url.

Texas Hill Country Facebook Page

I wonder if we’ll find the same number if we were to look at how many likes the website url or domain name has.

To figure this out, I appended Texas Hill Country’s url, http://www.texashillcountry.com, to the aforementioned link and found that it has 15,240 shares/likes. That’s certainly a ways different than their Facebook page.

Nevertheless, your web browser should return something similar to the following image:

Facebook Graph API Response Data - Texas Hill Country URL

When executing the link in a web browser, the Graph API returns a JSON object to the screen.

Notice the “comment_count” and “share_count” attributes listed as object attributes associated to the “share” attribute.

The “comment_count” attribute refers to the total number of comments a URL or domain has received, while the “share_count” attribute refers to the total number of shares/likes a URL or domain has received.

The JSON object also includes other attribute data such as id, description, title, type, and last update time.

PHP / Facebook Graph API Call to Retrieve and Display URL Data

Of course, I know some of you would like to access the Facebook Graph API data for a given URL.

So, the code below shows how to retrieve and display the URL data using PHP and PHP’s built-in curl method.

Included in the code, I show how to access the multi-dimensional PHP Array and the exact data point for total number of likes, rather the “share_count” attribute.

Here’s what the code above should look like when executed via a web browser:

PHP / Facebook Graph API Total Like Count

Although I’ve not looked or searched the web, there is likely a blog plugin or adapter for your website’s specific content management system (CMS) that would simply the code above to a few point and clicks.

Nevertheless, you now know how to retrieve a URL’s total count for likes using PHP and Facebook Graph API, or simply using the Facebook Graph API url with domain appended via web browser.

Evaluating Expired Domains using Facebook Graph API’s Count of Likes, Shares, and Comments for URL

Not only do I check Facebook Graph stats for websites I develop and manage from time to time, I also use this stat as one of many factors to help me to decide whether or not to bid on expired domain auctions.

If you didn’t know, Google values social signals for domain names. With hundreds of thousands of domains expiring daily, I use Facebook Graph stats to help me gauge my bidding interest for domains I’m on the fence about actively bidding.

I’ve also found expired domain gems with a trove of Facebook likes that I managed to snipe or purchase for BIN or closeout prices.

To learn more about how to use Facebook Graph API when evaluating expired domains, please watch my quick 5 minute tutorial below.

Also, please don’t hesitate to send me questions or comments about any of the topics I’ve mentioned above.

Please subscribe to my YouTube channel to receive tutorial alerts.

Written by Alvin Brown
He's an experienced and passionate serial entrepreneur, founder and publisher of Kickstart Commerce. Alvin possesses a great love for startups dominating their market using profitable digital strategies for greater commerce.