in PHP

Display Feedburner Subscribers

The Feedburner API has been shut down since October 20th 2012. You can still use the counter widget but can not use the API directly any more.
![Feedburner]( "1314041152_FeedBurner")## What Is Feedburner? Feedburner is a Google App that they bought back in 2007 for $100 million after just 3 years of being live. **Feedburner** allows website owners to submit their RSS feeds to keep track of the **statistics of the feed**. It will track how many subscribers you have and how they are using your feed. You can see what posts and being read and which ones people are clicking on. It will even show you which ones are the most popular. These statistics can help you analysis the popularity of your posts with your regular readers. **RSS Subscribers** are your returning readers they are people who want to be alerted when you release a new post and are most likely your website biggest fans, it is a good thing to watch how they are using your site. As these people are your returning visitors it is always a good idea to try and increase your subscribers lists as much as possible. Having 1000 people subscribed to your RSS feed means that every time you publish a new post 1000 people will be alerted that you have a new post and most of them will return to read your post. ## RSS Subscribers Show Popularity Having a large **subscriber list** is a good way of judging the popularity of your blog and is key to [have a successful website]( "How To Always Have A Successful Website"). Therefore if you can display this number other people will see this as you produce quality content and will most likely **subscribe** themselves. People like to follow **popular people**, if you show you are popular it encourages others to follow you as well. People will judge you by what others think so if you show you have a lot of subscribers it will lead to more **subscribers**. Same on social media if we see someone that has a lot of followers it encourages us to follow them too it's just the way the human mind works. It is a good thing to display how many followers you have to the world. But you don't want to show the world you only have 10 subscribers people won't want to follow you. But if you wait until you have at least over 100 subscribers then you might decide to display this count. ## How To Display Your Subscriber Count There are many widgets that will display your Feedburner count for you, or you can use the one on the Feedburner site. On your Feedburner feed go to the publicize tab and on the left sidebar you will see a link called FeedCount. Here you can generate your own Feedburner widget with your subscriber count you get to pick which colours to use but that's all the customization you get. ![Feedburner]( "Feedburner-FeedCount") The problem is this widget has been around for a long time and the styling is very old fashion the best thing you can do is get the subscriber count yourself so you can display the number in anyone way you want. [![](]( ## Google Feedburner API Google used to have a Feedburner API where you could access different parts of the Feedburner stats. FeedBurner offers developers an established (and growing!) library of web services for interacting with our feed management and awareness-generating capabilities. Using the features this library provides, anyone with a Google account enabled for the FeedBurner service may perform some of the most common actions available on our service programmatically. Outside applications and content management services, including popular blogging platforms, are already making use of this application programming interface (API) to help publishers promote feed stats in new and interesting ways. But this API has been **deprecated** by the Google development team but you can still use the API but it means they will not be adding any additional features to it in the future. ## Using Feedburner API With PHP Below I will teach you how you can use **PHP to get the Feedburner subscriber count** and display it on your page. Using the **API** means you can get your subscriber count and display it in any way you want, much better than using the **Feedburner widget**. First you need to turn on access to the **API** from the Feedburner admin screen, go to the publicize tab and click on the Awareness API tab. Now click **activate** to turn on access to your Feedburner. ![Awareness API]( "Awareness-API-Feedburner") We will be using the **PHP extension cURL** to access the data in the Feedburner account. Below is the code snippet you can use to get your subscriber list. First we enter the URL for your feed, you will need to change the uri to your own feed. You can find your feed ID by accessing your feed and grab the feed ID after The script will then send this request through curl and return the results in the variable $data, we then convert this into an XML object by using simpleXMLElement(). Now we can navigation down the nodes to the circulation attribute, store this value in a variable and display this variable in anyway you want in this example I am just printing out the content of the variable using an echo. ``` //feedburner api url $url = ""; //Initialize the Curl $ch = curl_init(); //Set curl to return the data instead of printing it to the browser. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2); //Set the URL curl_setopt($ch, CURLOPT_URL, $url); //Execute the fetch $data = curl_exec($ch); //Close the connection curl_close($ch); $xml = new SimpleXMLElement($data); $subscribers = $xml->feed->entry['circulation']; echo $subscribers; ``` ## Feedburner API Bug Although this is a very useful way to help **build subscribers** by showing off the amount of subscribers you have there is a **bug with this API**. Because of the popularity of this feature the API is not very reliable and will sometimes go down for up to 4/5 hours each day. This can lead to some feeds displaying a subscriber count of 0, which obviously you don't want to display that on your webpage. There are a number of workarounds to this problem some of them are terrible ideas. I found a site and their idea was to check if the value if 0 then change the number to something you think it is. I was going to link to this article to show you the solution but I don't want to give any links to this site because of this bad practice. If you want to see this post the website is called techpp. ``` if($subscribers == 0){ $subscribers = 8745; } echo $subscribers; ``` The reason you should never do this is because it is false and will not show your true subscribers. Worse than that is if your readers found out you were displaying then wrong data they will lose all **trust in your site**. The best solution to this problem is to cache the results once a day and display the cache results if it returns 0. Now you have learnt about Feedburner please [subscribe to my RSS feed]( "Subscribe To My RSS Feed"). I have created a demo page so you can see if in action.

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email