Posts Tagged ‘php’

Display A Text Version Of Your Feedburner Subscribers

All credit for this goes to, I’m simply re-posting because I find this to be extremely useful, and like to note stuff like this on my own blog.\r\n\r\nAlthough recognizable, the Feedburner chicklet that displays the number of subscribers is ehh.  I’d much rather be able to stylize the number itself and fit it into my own design.  Wouldn’t it be nice if you can pull the number out of the chicklet and do whatever you want?  You can, and it’s extremely easy!  You can see I just implemented this on the sidebar on Carbon Fiber Gear:\r\n\r\n


\r\n\r\nOf course that number can be styled however you want it using CSS.  So how do you get it?  Simply put this code somewhere in your WordPress template (Mine is in sidebar.php), and make sure to replace the “feedburnerid” with your ID in the $whaturl line:\r\n\r\n

\r\n<?\r\n	//get cool feedburner count\r\n	$whaturl="";\r\n\r\n	//Initialize the Curl session\r\n	$ch = curl_init();\r\n\r\n	//Set curl to return the data instead of printing it to the browser.\r\n	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\r\n	//Set the URL\r\n	curl_setopt($ch, CURLOPT_URL, $whaturl);\r\n\r\n	//Execute the fetch\r\n	$data = curl_exec($ch);\r\n\r\n	//Close the connection\r\n	curl_close($ch);\r\n	$xml = new SimpleXMLElement($data);\r\n	$fb = $xml->feed->entry['circulation'];\r\n	//end get cool feedburner count\r\n\r\n	// Use $fb to print out the number of subscribers\r\n	echo 'Join the <i>' . $fb . '</i> subscribers';\r\n?>\r\n

\r\n\r\nYou’ll need to make sure the feed count service is activated. To do that, login to your Feedburner account, hit the “Publicize” tab, and then go to to Feed Count. On this page you’ll need to activate the service. There you have it!