源代码也是从网上获取的,做了一点修改,下面贴出来。

    <?php
    function load_file($url) {
    $ch = curl_init($url);
    #Return http response in string
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $xml = simplexml_load_string(curl_exec($ch));
    return $xml;
    }

    $feedurl = '**feedurl**';
    $rss = load_file($feedurl);
    echo "<ol>";
    foreach ($rss->channel->item as $item) {
    echo "<li>";
    echo "<a href='$item->link'>". $item->title ."</a>";
    echo "</li>";
    }
    echo "</ol>";
    ?>