<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vision Master Designs &#187; CURL</title>
	<atom:link href="http://visionmasterdesigns.com/tag/curl/feed/" rel="self" type="application/rss+xml" />
	<link>http://visionmasterdesigns.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 29 Oct 2009 20:00:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tutorial : Display no.of RSS Readers using Feedburner API and PHP (curl)</title>
		<link>http://visionmasterdesigns.com/tutoral-display-noof-rss-readers-using-feedburner-api-and-php-curl/</link>
		<comments>http://visionmasterdesigns.com/tutoral-display-noof-rss-readers-using-feedburner-api-and-php-curl/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 18:54:06 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[PHP & MySQL]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[CURL]]></category>
		<category><![CDATA[Feedburner]]></category>

		<guid isPermaLink="false">http://www.visionmasterdesigns.com/?p=932</guid>
		<description><![CDATA[Most of you who have blogs/website might be aware of FeedBurner. Its a service which provides custom RSS Management tools like Analysing Web-Traffic, the number of readers subscribed to you blog etc. I too use Feedburner to help me keep track of my feeds and its readers. Although I love their service, I always found [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin: 0 0 0.6em 0.6em;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fvisionmasterdesigns.com%2Ftutoral-display-noof-rss-readers-using-feedburner-api-and-php-curl%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fvisionmasterdesigns.com%2Ftutoral-display-noof-rss-readers-using-feedburner-api-and-php-curl%2F&amp;source=rowoot&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Most of you who have blogs/website might be aware of FeedBurner. Its a service which provides custom RSS Management tools like Analysing Web-Traffic, the number of readers subscribed to you blog etc. I too use Feedburner to help me keep track of my feeds and its readers. Although I love their service, I always found the FeedBurner Chicklet (It displays the number of readers subscribed to your RSS) to be a constraint, it isn`t that flexible i.e We can modify the color of the chicklet but not the chicklet it self. So I decided to create my own Chicklet to help me display the number of readers subscribed to my blog. (Although the number isn`t that big <img src='http://visionmasterdesigns.com/wordpress/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )<br />
<span id="more-932"></span></p>
<h4>It Starts ! Feedburner API</h4>
<p>Hmm..so where did I start&#8230;. Ahh ! The Feedburner API ofcourse. I wanted to know how to retrieve the number of Readers of a particular RSS feed as simple text.<br />
<a href="http://code.google.com/apis/feedburner/awareness_api.html" target="_blank">http://code.google.com/apis/feedburner/awareness_api.html</a> had the answer to my problem !</p>
<blockquote><p>Current Basic Feed Awareness Data<br />
<code>https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=&lt;feeduri&gt;</code></p>
<p>where &lt;feeduri&gt; = your feedname i.e <strong>vmdtuts</strong> in my case</p>
<p>Sample Response<br />
<strong>circulation</strong> &#8211; An approximate measure of the number of individuals for whom your feed has been requested in the 24 hour period described by date.</p></blockquote>
<p>Thats what I was looking for !!. Now Since I have a way to access information about my RSS feeds, I had to think of a method to request the API url and retrieve the result using PHP (ofcourse).<br />
<strong>Note :</strong> If you try to access the above URL with your feed address, you`ll see an XML output with all the relevant details about your feed !.</p>
<h4>Thank You CURL &#8211; Here is the Code</h4>
<p>We`ll use CURL to make a request to the above URL and retrieve the XML output.</p>
<pre class="brush: php">
$my_feed_url = &quot;https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=yourfeedurl&quot;; // yourfeedurl = vmdtuts in my case

$s_ch = curl_init(); //Initialize Curl
curl_setopt($s_ch, CURLOPT_RETURNTRANSFER, 1);//Set curl to return the data instead of printing it to the browser.
curl_setopt($s_ch, CURLOPT_URL, $my_feed_url); //Set the URL
$data = curl_exec($s_ch); //Execute the fetch
curl_close($s_ch); //Close the connection
$xml = new SimpleXMLElement($data);
$no_of_readers = $xml-&gt;feed-&gt;entry[&#039;circulation&#039;];

echo $no_of_readers.&quot;Readers&quot;; //Will display no of Readers
</pre>
<p>Voila There you have it. A Simple method to retrieve the number of readers who have subscribed to your RSS.</p>
<p><strong>Tip</strong> : If you want to display the number of Readers in your WordPress Blog. Just open up sidebar.php and insert the code anywhere where you want to display the number of readers.</p>
]]></content:encoded>
			<wfw:commentRss>http://visionmasterdesigns.com/tutoral-display-noof-rss-readers-using-feedburner-api-and-php-curl/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
