How do you display your FeedBurner feed count in plain text in sidebar or index page or Post page of your blog,without using the FeedBurner Feed Count button provided by Feedburner? Feedburner Feed Count usually is a dynamic graphic that always displays your feed’s current circulation, as calculated by FeedBurner. You can customize by Choosing its color scheme and an animated or static appearance.
But what if you want to display the Feedburner feed count in text in a page or side bar? This can be achieved easily. if your site supports PHP this tutorial is for you. If you are using wordpress platform for your blog then you can directly use the code provided here. If you want just quick view of your Feedburner RSS subscriber statistics then you can use the Feedburner feed stats: Globinch Feedburner RSS Feed Statistics Tool . Globinch Feedburner RSS Feed Statistics Tool gives you an easy interface to get all the feedburner RSS feed stats including circulation, reach, downloads and hits of your blog’s feedburner rss feed and also supports different date ranges in the report.
Display FeedBurner Subscriber Count As Text
If you know PHP programming then this is very easy. Otherwise copy and paste the below code in any PHP file where you want the Feedburner RSS subscriber count to appear in Text. In wordpress you can create a new PHP page or you can add this code in any of the template files. Use some CSS styles and will appear similar to the below image.
We can use the Awareness API (AwAPI) to get the Feedburner RSS feed count. To use this API, feedburner id is mandatory. This is a part of your Google Feedburner feed url.For example: http://feeds.feedburner.com/feedaddrr . Here “feedaddrr” is the Feedburner id.
Normally the result from the will be in te form of XML. To get the subscriber count just parse and get the count from xml. See one sample XML below
1 2 3 4 5 6 | <?xml version="1.0" encoding="UTF-8"?> <rsp stat="ok"> <feed id="xxxxxxxx" uri="xxxxx"> <entry date="2010-10-08" circulation="1280" hits="1257" reach="1256" /> </feed> </rsp> |
Yiu can use the following code to display the feed count in text. As mentioned above the below code uses the feedburner Awareness API (AwAPI).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php $feedburnerid = "globinch"; $stringVal=""; $url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri="; $url= $url. $feedburnerid; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($data); $feedcount = $xml->feed->entry['circulation']; // The above $feedcount value can be displayed any where in the page below the above code using echo. Eg.:echo $feedcount +"RSS Feed Readers Today"; ?> |
If you are using wordpress and if you want to display the count in the sidebar, open the “sidebar.php” and copy and paste the above code. use the “echo” mentioned in the above code to display the Feedburner feed count in sidebar.
Before you go, subscribe to get latest technology articles right in your mailbox!.
I was wondering if you could point me in the right direction or give me an idea where to look.
I have tried your code without changing a thing (even leaving your blog in there) and it give me an error. This same type of error has happened with any code I try like this all over the web.
I can get my XML when I enter the path in a browser and save the file so I know I have feedburner set up correctly.
This is the error I get:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in D:Hosting2014991html262questfeeds.php:12 Stack trace: #0 D:Hosting2014991html262questfeeds.php(12): SimpleXMLElement->__construct('') #1 {main} thrown in D:Hosting2014991html262questfeeds.php on line 12
I have compared my xml to your xml and it looks correct. I am at a loss as what to do.
I have uploaded the file to two different servers with PHP5 running and other PHP works fine.
Thanks!
Tim
Hi Tim,
If you could provide me your feedburner id (like "globinch" in the example) I can try that and let you know the exact reason.
Thanks for visiting
Binu George
I ended up getting it tow work, and then it started to work with all the other code as well. I had to change the feedburner url and remove the ssl https:// and access in in the non-ssl way http://
Not sure why, or why this seems to be the only way that it works for me when everybody's code uses ssl.
I thought it was a requirement to use ssl and everyone's code uses ssl, however the only way it will work for me is without ssl.
Any thoughts?
One possibility is that at some point during the connection between your server and feedburner , some entity blocked your secure connection and returned some error string.
May be some component was blocking the secured connection. If you look at the error message you got("Fatal error: Uncaught exception ‘Exception’ with message ‘String could not be parsed as XML’ in D:Hosting2014991html262questfeeds.php:12" ) it is clear that the server was not returning XML but some strange error string. The program was not able to parse that because that is not in XML format.
For example the Feedburner server or may be some entity like a firewall blocked the communication and returned the error like "Access Denied. Not authorize to use the resource". The program cannot parse this because of non-XML structure.
You can verify the outgoing communication protocol supported by your web server and firewall etc..
Hmmm, strange.
So it could be my host is blocking https traffic going out which would block any code from querying any https web service like this. I wonder if this is typical because I have tried it with my GoDaddy host and also with an external free host I set up for testing. I will try a third one just to see. I also have the ability to test on a internal server that I manage at work if it comes down to that.
Thanks!