Feedburner Awareness API

Topics: ASP.NET 2.0, Controls
Sep 11, 2007 at 1:29 AM
I've done something for my blog and I would like to share with you all.

I was checking the Feedburner Awareness API (http://www.feedburner.com/fb/a/developers/awapi) and Ive done a small function to return how many feed readers I could have. This is the function:

protected string LoadFeed()
string getVars = "?uri=yourfeeduri"; //your feed uri
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(string.Format("http://api.feedburner.com/awareness/1.0/GetFeedData{0}", getVars));
WebReq.Method = "GET";
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();

Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
string strFeed = _Answer.ReadToEnd();

return strFeed.Substring(strFeed.IndexOf("circulation=\"") + 13, strFeed.IndexOf("\" hits=") - strFeed.IndexOf("circulation=\"") - 13);

I hope it can be useful for someone here. Feel free to improve or create an extension/control if you want. :-)