// Get Feedburner RSS Subscriber count as plain text add_option('myfeeds_count','0','','yes'); add_option('myfeeds_api_timer',mktime() - 10000,'','yes'); function myfeeds_count() { $rsscount = get_option('myfeeds_count'); if ( get_option('myfeeds_api_timer') < (mktime() - 3600) ) { // EDIT your Feedburner feed name here: $fb_id = "fleek/oakS"; $subscribers = curl("https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=" . $fb_id); try { $xml = new SimpleXmlElement($subscribers, LIBXML_NOCDATA); if ($xml) { $rsscount = (string) $xml->feed->entry['circulation']; update_option('myfeeds_count', $rsscount); } } catch (Exception $e) { } update_option('myfeeds_api_timer', mktime()); } //Echo the count if we got it if($rsscount == 'N/A' || $rsscount == '0') { echo 'many other'; } else { echo $rsscount; } }
Понравилась статья? - Подпишись. Или поделись полезным с миром
<?php if (function_exists('myfeeds_count')) myfeeds_count(); ?>
// Get Twitter Follower count as plain text
add_option('mytwitter_followers','0','','yes');
add_option('mytwitter_api_timer',mktime() - 10000,'','yes');
function mytwitter_followers() {
$twittercount = get_option('mytwitter_followers');
if ( get_option('mytwitter_api_timer') < (mktime() - 3600) ) {
// EDIT your Twitter user name here:
$twitter_id = "sizamas";
$followers = curl("http://twitter.com/users/show.xml?screen_name=" . $twitter_id);
try {
$xml = new SimpleXmlElement($followers, LIBXML_NOCDATA);
if ($xml) {
$twittercount = (string) $xml->followers_count;
update_option('mytwitter_followers', $twittercount);
}
} catch (Exception $e) { }
update_option('mytwitter_api_timer', mktime());
}
if ( $twittercount != '0' ) { echo $twittercount; }
else { echo "growing number of"; }
}
<?php if (function_exists('mytwitter_followers')) mytwitter_followers(); ?>
Если судить по работе контекстной рекламы, то такие кнопочки должны быть вначале поста,в конце поста и сбоку, тогда конвертабельность посетителей в подписчики должна вырасти на порядок.
2 tonymihay: Ваш хостинг не поддерживает cURL (сам с этим столкнулся). Замените curl на file_get_contents. Смысл тот же самый, если в подробности не сильно вдаваться.
Как вывести фиды без использования плагина я узнал, контейнер сделан на основе css3 (не картинка), т.е. без плагинов. Вот я у вас и спрашиваю, как можно подобное сделать для твиттера (сам контейнер).
Вот этот контейнер для фида я подсмотрел у Dimox’a.