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.
Comment | File | Size | Author |
---|---|---|---|
#1 | feedburner-awareness-api-url.patch | 791 bytes | Greg Go |
#1 | README-API.txt | 2.87 KB | Greg Go |
Comments
Comment #1
Greg Go CreditAttribution: Greg Go commentedoops, patches attached.