treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Display FeedBurner Feed Count

Last updated on:

<?php
    //get cool feedburner count
    $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=your 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'];
    echo $fb;
    //end get cool feedburner count
?>

Replace "your feedburner id" with your actual FeedBurner ID. Also, make sure your "Awareness API" is turned on in your FeedBurner settings for the particular feed you are pulling from.

View Comments

Comments

  1. Permalink to comment#

    Hello,

    this doesn’t work anymore. The url changed since feedburner is a part of google.
    This request will work with a new url “https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=”.

    Note: you need to activate this service by the feed settings “Publicize > FeedCount”

  2. Mark Anthony
    Permalink to comment#

    Can you do this on jquery or javascript? thanks!

Leave a Comment

Use markdown or basic HTML and be nice.