Get FeedBurner Subscriber Count with cURL

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://feedburner.google.com/api/awareness/1.0/GetFeedData?id=7qkrmib4r9rscbplq5qgadiiq4');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
$content = curl_exec($ch);
$subscribers = get_match('/circulation="(.*)"/isU',$content);
curl_close($ch);

The $subscribers variable will then be your subscriber count, for echoing out (or whatever). You'll need to replace the ID at the end of the second line with your feed's ID (find it). You'll also need to have the Awareness feature of FeedBurner enabled.

Comments

  1. User Avatar
    SubSONiK
    Permalink to comment#

    I used the above code with my id:

    but i get an error message like this:

    Fatal error: Call to undefined function get_match() in /home/boom/public_html/subscribers.php on line 14

    my id is valid, checked the xml file: https://feedburner.google.com/api/awareness/1.0/GetFeedData?id=c0plc3tf94g80eaqavodrdsgvg

    Is it a webhosting issue maybe? My server supports PHP Version 5.2.6

    Thanx!

    • User Avatar
      Chris Coyier
      Permalink to comment#

      I think that function probably needs to be defined elsewhere…

      function get_match($regex,$content)
      {
        preg_match($regex,$content,$matches);
        return $matches[1];
      }
  2. User Avatar
    SubSONiK
    Permalink to comment#

    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,’https://feedburner.google.com/api/awareness/1.0/GetFeedData?id=c0plc3tf94g80eaqavodrdsgvg’);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
    $content = curl_exec($ch);
    $subscribers = get_match(‘/circulation=”(*)”/isU’,$content);
    curl_close($ch);

  3. User Avatar
    Jitendra Kumar
    Permalink to comment#

    Nice information! It can be used with images and CSS to produce great result…

  4. User Avatar
    Ahmed AG
    Permalink to comment#

    can you give me a demo for it, how it will look? , and can it be used on wordpress?

  5. User Avatar
    Joe
    Permalink to comment#

    The avarnes API is no longer available. We need to find a way to get the amount of subscribers without the API.

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag