How To Display Feed Count For Google FeedProxy In Text

January 8th, 2009 in Articles, News, WordPress by kailoon

Everyone knows that feedburner had merged with Google. This also lead to the previous feed counter in text doesn’t work. I just found out the solution for whoever is using feed counter in text with feedburner before and now converted into Google FeedProxy. Thanks to one of my user of “Our Community” – mtsandeep.

To Display Feedburner Subscriber Count In Text

Copy paste the following code into your template, replace feedburner-id with your Feedbuner username.

//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

Paste this anywhere you want and it’ll display a Feedburner subscriber count in text.

echo $fb;

To Display Feed Counter For Google FeedProxy In Text

Use the previous code. Change this:

$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id";

Into This:

$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id";

Full Code:

//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

Subscribe To Our Feed

If you find our site is interesting, please subscribe to our feed. Thanks!
add RSS

Comments

New to Old.
  • http://www.kailoon.com Jan 20, 2009

Reply

Write your comment here...




XHTML::
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Flickr

Join our Flickr Group and showcase your creativity!

Twitter

Like my work? Want to know what I'm up to all day long? Follow me!
Follow me on Twitter.