subscriber count , follower count with PHP

subscriber count ကို feed burner ကနေ ယူချင်တာနဲ့ API လေး စမ်းဖြစ်သွားတယ်။ feed burner api မလုပ်ခင် api ကို allow လုပ်ပေးဖို့လိုတယ်။

  1. login your feedburner and go to your feed.
  2. Go to Publicize tag
  3. Go to Awareness Api and active it.


code ကတော့ အောက်က အတိုင်းပဲ။ ဒါပေမယ့် uri ဆိုတဲ့နေရာမှာ ကိုယ့် uri လေး ထည့်ပေးဖို့လိုပါတယ်။

<?php
//get cool feedburner count
$toopen="http://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=saturngod";

$ch = curl_init(); /// initialize a cURL session
curl_setopt($ch, CURLOPT_URL, $toopen );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec ($ch);//end get cool feedburner count
curl_close($ch);

$dom = new DOMDocument();
$dom->preserveWhiteSpace = false;
$dom->loadXML($content);
$count=$dom->getElementsByTagName("entry")->item(0)->getAttribute("circulation");
echo $count;
?>

Twitter ကတော့ တော်တော်လွယ်ပါ့။ screen_name မှာ twitter account name ထည့်လိုက်ရုံပဲ။

<?php

$toopen="http://twitter.com/users/show.xml?screen_name=saturngod ";

$ch = curl_init(); /// initialize a cURL session
curl_setopt($ch, CURLOPT_URL, $toopen );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec ($ch);//end get cool feedburner count
curl_close($ch);

$dom = new DOMDocument();
$dom->preserveWhiteSpace = false;
$dom->loadXML($content);
$count=$dom->getElementsByTagName("followers_count")->item(0)->nodeValue;
$twitt=$dom->getElementsByTagName("text")->item(0)->nodeValue;

?>

4 Comments

  1. RSS Feed လုပ်ချင်ပါတယ်
    ကျွန်တော့်မှာက Database ကနေဆွဲခေါ်အသုံးပြုထားတဲ့
    PHP Base Feed(rss.php) ပဲရှိတာပါ၊ကျွန်တော်လိုနေတာက Facebook အတွက်ပါ..
    သူက XML File ကိုပဲလက်ခံတယ်ဗျာ (rss.xml) ကိုပြောင်းချင်တယ်ဗျာ
    ဘယ်လိုလုပ်ရမလည်း Online မှာရော ဒီ Service ပေးတဲ့ Website တွေရှိပါသလား
    Pure XML Feed ကို ရဖို့ Real Time Update လုပ်နေဖို့လိုနေတယ်အကိုရေ
    Blog မဟုတ်ပဲ Website ဖြစ်တော့ခေါင်းစားတယ်ဗျာ…တကယ်လို့ အကူညီလေးသာပေးနိုင်ရင်
    ကျေးဇူးအရမ်းတင်မိမှာပါပဲ၊အချိန်ယူဖတ်ပေးတာကျေးဇူးတင်ပါတယ်…

    1. saturngod says:

      .xml extension ကိုပဲ လက်ခံတာကို ပြောတာလား။ နောက်တနည်းက feedburner ကို သုံးကြည့်ပါ။

  2. minkok110 says:

    ဟုတ်တယ်လေအကို….
    ဥပမာ အကိုရာ ဒါကျွန်တော့် Feed ပါ http://www.myanmaritjobs.com/rss.php
    အဲ့ဒါက .php ဖြစ်နေတယ်လေအကို…
    အဲ့ဒါကို .xml ပြောင်းချင်တာပါ
    .xml ပဲသုံးလို့ရမှာမို့ပါခင်ဗျ
    PHP feed to xml feed ပေါ့အကိုရာ ဘယ်လိုလုပ်ရင်ကောင်းမလည်းဗျာ
    ကျေးဇူးတင်ပါတယ် အချိန်လေးနည်းနည်းဖဲ့ပေးပါဦးဗျာ
    ဒီ Feed Burner က xml ပြောင်းပေးလား ?

    1. saturngod says:

      if you have a time, ask in mysteryzillion.org. I don’ understand, why facebook only allow .xml file. However, your question is not related is not this post. Ask in http://www.mysteryzillion.org , please.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.