2012-11-09 55 views
1

我已經使用基於WordPress的PHP函數很長一段時間了,以檢索Feedburner訂閱者數量,以便能夠將訂閱者數量顯示爲文本。如何在PHP和WordPress中獲取Feedburner RSS訂閱者數量

下面是函數:

/** 
* Fetch Feedburner RSS Feed Subscribers. 
* 
* @param string $feed The feed to fetch. 
* @return int of Feedburner RSS subscribers. 
*/ 
public function get_feedburner_subcribers($feedburner_username){ 
    $xml = wp_remote_get('http://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=' .$feedburner_username); 

    if(is_wp_error($xml)) 
     return false; 

    try { 
     $sxe = @new SimpleXMLElement($xml['body']); 
    } 
    catch (Exception $e) { 
     // SimpleXMLElement::__construct produces an E_WARNING error message for 
     // each error found in the XML data and throws an exception if errors 
     // were detected. Catch any exception and return failure (NULL). 
     return; 
    } 

    return self::format(intval($sxe->feed->entry['circulation'])); 
} 

所有,直到最近,當函數不再返回任何值偉大的工作。

如果我直接粘貼網址http://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=my-feedburner-id,我得到一個Google Error 404頁面。

Google是否改變了一切,如果有的話,是否有其他方法來檢索Feedburner計數?

感謝

回答

2

Feedburner APIno longer available。它在2012年10月20日關閉(更詳細here,包括關機日期。)

+1

感謝馬特的信息。這是令人失望的。那麼有沒有其他辦法可以讓你知道Feedburner的數量? – Jason

+1

不是我所知道的。還有相當廣泛的關注(https://www.google.com/search?client=safari&rls=en&q=moving+away+from+feedburner&ie=UTF-8&oe=UTF-8),Feedburner本身將會在一些消失點。您可能需要做一些調查,並決定是否要在服務中投入更多時間。 –

+0

謝謝馬特,我感謝你的時間。 – Jason