Plain Text Subscriber Count (Feedburner / Google)

By gilbitron in PHP on 23/02/2009 at 06:08

Views: 426
Tagged: php
URL: http://progtuts.info/237/plain-text-feedburner-subscriber-count/

Starter:

Plain text Feedburner (now Google) subscriber count on your website using php and curl.

Note: This will require PHP 5+ to run.

Main Course:

<?php
$feeduri = "example"; //The bit that comes after http://feeds.feedburner.com/
//This is the old Feedburner url
//$url = "http://api.feedburner.com/awareness/1.0/GetFeedData?uri=". $feeduri;
//This is the new Google Feedburner url
$url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=". $feeduri;
$ch = curl_init(); //Use cURL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Return data rather then echo it
curl_setopt($ch, CURLOPT_URL, $url); //Pass in our url
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data); //Read the returned XML
$count = $xml->feed->entry['circulation']; //Get our subscriber count
?>

Expand Report Code | Install Coda Clip

Please log in to vote.

Compliments to the Chef

No comments yet...

How was your Meal?


  • Allowed HTML: <b><strong><u><i><em><a>

  • Why ask? It helps us stop spam comments.