Attached is a patch that changes the Awareness API target url from the default to:

$request->url = 'http://feedburner.google.com/api/awareness/1.0/'. $function;

This enables to get a feed's subscriber count (circulation), hits and reach. For example:


  module_load_include('inc', 'feedburner', 'feedburner.admin');
  $result = _feedburner_request_api('GetFeedData', array('uri' => 'wisebread'));
  // uncoment to see object structure
  // print '<pre>'; print_r($result); print '</pre>';
  if ($result->code == 200) {
    $attributes = $result->data->feed->entry->attributes();
    $feedburner_subscribers = $attributes['circulation'];
    $feedburner_hits = $attributes['hits'];
    $feedburner_reach = $attributes['reach'];
  }
  else {
    $error_code = $result->code;
    $error_message = $result->error;
  }

The attached README-API.txt gives an example usage of the _feedburner_request_api() function (very nice work btw!) and shows the print_r() output of some responses. Right now it only mentions the GetFeedData function because that's the only one I used. The readme is not essential but I think it would be useful for developers to have the response object handy.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Greg Go’s picture

oops, patches attached.