显示 FeedBurner 订阅人数

Avatar of Chris Coyier
Chris Coyier
<?php
    //get cool feedburner count
    $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=your feedburner id";

    //Initialize the Curl session
    $ch = curl_init();

    //Set curl to return the data instead of printing it to the browser.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    //Set the URL
    curl_setopt($ch, CURLOPT_URL, $whaturl);

    //Execute the fetch
    $data = curl_exec($ch);

    //Close the connection
    curl_close($ch);
    $xml = new SimpleXMLElement($data);
    $fb = $xml->feed->entry['circulation'];
    echo $fb;
    //end get cool feedburner count
?>

将“your feedburner id”替换为你的实际 FeedBurner ID。此外,请确保在你的 FeedBurner 设置中,针对你正在提取的特定订阅源,已开启“Awareness API”。