Friday, October 19, 2012

Show feedburner subscription count as text in blogger

If you are a pro blogger you must know about feedburner feed count widget.They provide a decent widget that show off your SUBSCRIBERS count.But lets face it, it is very boring.I want to get SUBSCRIBERS count  as  text and then style it with CSS.its very easy to get SUBSCRIBERS  count using feedburner API.So lets do that.this tutorial involve PHP.So follow the steps carefully.

 

What you need

1.A php host
2.A php file


Set up the PHP file

This file contain php code to show SUBSCRIBERS  count.

1.Go to notepad or dreamweaver or notepad++
2.Paste this code
<?
function get_match($regex,$content)
{
  preg_match($regex,$content,$matches);
  return $matches[1];
}
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://feedburner.google.com/api/awareness/1.0/GetFeedData?id=subgo6gt3nqm7sblobs5rklfv0');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
$content = curl_exec($ch);
$subscribers = get_match('/circulation="(.*)"/isU',$content);
curl_close($ch);
echo " document.write('$subscribers');";
?>
Thanks to  CSS-TRICKS for the PHP code
3.Change the id in red with your feed id.If you dont know your feed id follow this post.
4.Save it as rss.php.or any name you want you must add .php after the filename.Remember you cant view a php page by opening the file with browser.
5.to view a php file you need a server or xampp in your computer.you can find more about xampp in google.

Find a PHP host

You need a host that allow you to host and access php files.You can find many free php hosting site.Just ask GOOGLE.I hosted my php file to my friends server.Here is my php file

http://whatthefunk.co.in/Event/test.php

 Dont use my php page if will show my blogs subscriber count.
1.If you have found a free hosting that let you host php files.Crate a a/c there.get access to the control panel.Upload the PHP file in public_html folder.And get the link of the php file like mine.
2. Now that you hosted php file in a server u can preview it.by going to that link.
3.If you visit my link.It will show this text
document.write('353');
4.If your  php link shows same like mine.then your php code is working fine.
5.Number in red is subscribe count.
6.Here is few free php host i know
  1. 110mb.com
  2. Athost
  3. Bythehost
  4. 000webhosting (i used it before)
7.Download my PHP file.dont forget to edit the feedburner id
http://dl.dropbox.com/u/55226/test.php

Almost there 

Now its time to show the count as text in blogger.
1.Log in to blogger.Go to Layout page.Add new gadget.Select HTML/Javascript.
2.Paste this code
<span id="rss">
<script type="text/javascript" src="http://yourhost.co.in/rss.php"></script></span>
3.Output will be.
<span id="rss">No of your subscribe</span>
4.You can style the count by adding this CSS rule.Be creative.
span#rss{
CSS code goes here
}
If you face any problem let me know.and dont forget to share this tutorial.Next tutorial i will show you how to get Twitter and facebook follower and fans count using jQuery.

    10 comments:

    1. thanks for the tut.
      but it does not display any count. the output i get is document.write('');
      please help

      ReplyDelete
    2. I have private solution on how to read number of FeedBurner readers without API dynamically. And then post that number anywhere on your website. Also have plugin for Wordpress. Example here: seo-doorways.ru (right widget and in sidebar). Will sale for $5. ICQ 3355two9743

      ReplyDelete
    3. pg slot ฟรี เครดิต แค่สมัครสมาชิกวันนี้รับทันทีเครดิต100% ฝากถอนง่ายๆไม่กี่ขั้นตอนกับเกมสล็อตออนไลน์คุณภาพอย่างค่าย PG SLOT ที่เว็บ PG-SLOT.GAME ของเรามอบให้ลูกค้าทุกท่าน

      ReplyDelete
    4. เข้าใจ PG Slot ให้ลึกลงเป็นเกมสล็อตออนไลน์ที่มีความนิยมอย่างมากในปัจจุบัน ด้วยความสะดวกสบายและรวดเร็วในการเล่น เรามีทางเข้าไหนบ้างที่สามารถใช้งานได้ดีที่สุดใน PG

      ReplyDelete
    5. AKBET25 เว็บพนันบอลออนไลน์ ที่ดีที่สุดในไทย สมัครกับเว็บตรงไม่ผ่านเอเย่นต์ สมัครง่าย PG ได้เงินจริง ฝาก-ถอน ออโต้ 30 วิ บริการตลอด 24 ชั่วโมง

      ReplyDelete
    6. การใช้ youtube คือแพลตฟอร์มออนไลน์ที่เชื่อมโยงผู้คนและธุรกิจกันเพื่อเป็นช่องทางในการซื้อ-ขายสินค้าและบริการใน PG SLOT โดยมีจุดเด่นในการทำให้การตลาดและการเผยแพร่

      ReplyDelete
    7. PG SLOT AUTO ทางเข้า สมัคร สล็อต ฝากถอนออโต้ ไม่มีขั้นต่ำ ฟรีเครดิต PG SLOT ทดลองเล่นฟรี รวดเร็ว ปลอดภัย รองรับ ทรูมันนี่ ทรูวอลเล็ท ลิขสิทธิ์แท้ ระบบ AUTO มีดีที่มีระบบ

      ReplyDelete
    8. Luckyall99 เป็นแหล่งรวมเกมคาสิโนออนไลน์ที่มีความน่าเชื่อถือและได้รับความนิยมจากผู้เล่นมากมายทั่วโลก โดยเว็บไซต์นี้มีเกม PG SLOTออนไลน์

      ReplyDelete
    9. 918kiss สมัคร ยอดเยี่ยม เว็บสล็อตออนไลน์ที่ผู้เล่นทุกคนกำลังเอ๋ยถึงเดี๋ยวนี้ pgslot เว็บไซต์พนันออนไลน์มาแรงที่กล้าออกโปรโมชั่นต้อนรับสมาชิกใหม่ แจกเครดิตเล่นเกมได้ไหลลื่น

      ReplyDelete
    10. gamble money การพนันกับเงินคือการลงเดิมพันเงินที่มีความเสี่ยงสูงโดยว่าจะได้รับเงินรางวัลใน PGSLOTหรือไม่ขึ้นอยู่กับผลของเหตุการณ์หรือสิ่งที่ลงเดิมพันไว้

      ReplyDelete