
We previously showed how you can display Feedburner feed count in raw text. However, if you’ve recently migrated your feed from Feedburner to Google Feed, you’ll noticed those codes will no longer work. Here’s the workarounds, for those who wanted to display Google Feed subscriber count in text for better styling.
Previous Code For Feedburner…
This code will only work if you intend to display Feedburner feed count in text, but for those who are already on Google Feed, some changes are required.
//get cool feedburner count $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id"; //Initialize the Curl session $ch = curl_init(); //Set curl to return the data instead of printing it to the browser. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set the URL curl_setopt($ch, CURLOPT_URL, $whaturl); //Execute the fetch $data = curl_exec($ch); //Close the connection curl_close($ch); $xml = new SimpleXMLElement($data); $fb = $xml->feed->entry['circulation']; //end get cool feedburner count
The Solution
Replace line:2 from:
//get cool feedburner count $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id";
to the following:
//get cool feedburner count $whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id";
The Complete Code
Here’s the complete set of code to display Google Feed subscriber count in text. Remember to replace feedburner-id (line:2) with your real feed ID.
//get cool feedburner count $whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id"; //Initialize the Curl session $ch = curl_init(); //Set curl to return the data instead of printing it to the browser. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set the URL curl_setopt($ch, CURLOPT_URL, $whaturl); //Execute the fetch $data = curl_exec($ch); //Close the connection curl_close($ch); $xml = new SimpleXMLElement($data); $fb = $xml->feed->entry['circulation']; //end get cool feedburner count
Troubleshoots
Here are some of the possibilities if the above code don’t work for you:
- Double check if you’ve correctly replaced
http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-idwithhttps://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id - Did you replaced
feedburner-idwith your actual Feed ID? SimpleXMLElements requires PHP5. If nothing shows up, chances are your web host is still on PHP4. You should contact them about the upgrade.
Related Contents |
Sponsors |
|
Posted by hongkiat in How-To , at 01.22.09
Tags: count, feed, feedburner, feedproxy, Google, number, subscriber, text |
|






















Comments
dev January 22nd, 2009
Wow, thank man
ReplyDKumar M. January 22nd, 2009
Nice Tutorial Mate, Thanks For sharing !!!
ReplySean Hurley January 22nd, 2009
Hey, ,, maybe i have missed the post but do you ever show someone an simple way to customize the feed burner subscribe tool? Without any design its just submit email here and a text field.
ReplyDavid Pierce January 23rd, 2009
Thanks for this tutorial! A number of my favorite blogs have this feature, and it’s far more attractive when it’s written out as opposed to the little Feedburner chicklet.
Well-written, and bold to try troubleshooting beforehand. Thanks!
ReplyAmirez January 23rd, 2009
thanks a lot man. this what i looking for a long time. great tutorial
ReplyVikram January 23rd, 2009
How do i do this with my blogger based blog man?
Replyhongkiat January 23rd, 2009
@Vikram Here’s something for the blogger. http://tinyurl.com/7q7bn6. I’ve not try them personally but hope it still works :-) Remember to change the feedburner URL to Google Feed.
ReplyPaul Tan January 24th, 2009
You can use this for blogger.
google feedburner: http://www.feedtxt.com/gf/your feed id here/show.js
feedburner: http://www.feedtxt.com/fb/your feed id here/show.js
for example, for your blog…
http://www.feedtxt.com/gf/nampblog/show.js
ReplyWoodstock Real Estate January 25th, 2009
Thanks Hong, this tutorial is much easier to follow than the other ones that I have found. You are a great communicator!
ReplyJen January 25th, 2009
Nice! This will definately help me gain more subscribers…
ReplyBest Design Options January 25th, 2009
This is actually what I’ve been looking for! Thanks for this very useful post!
ReplyRahul January 25th, 2009
Hey man, all the hard work done by Hongkiat. We just need to do is copy & paste only. Thanks for all the codes. Cheers.
ReplyYong How January 26th, 2009
Nice one. thx for sharing the codes. I just need it for my blog.
Replyironman January 27th, 2009
this is very nice hint
ReplyAtlanta Georgia Real Estate February 3rd, 2009
These codes are great. I incorporated them already on one of my sites already!
ReplyDanial March 8th, 2009
Thanks For This Post .
ReplyJack November 2nd, 2009
Nice codes, thank you!
ReplyTrackbacks