PHP rss 阅读器不起作用


PHP rss reader doesn't work

嘿,我写这篇文章是为了获取FB页面提要并将其输出到站点。

它在我的本地主机上工作得很好,但当它放在服务器上时就不行了。它只是空白的。

<?php
$xml_url = "http://fbrss.com/f/7f823b5ba0557decbd324199136326ac_7LpQh7MAJ22MISS1omjI.xml";
$xml = simplexml_load_file($xml_url);
$json = json_encode($xml);
$objects = json_decode($json,TRUE);
$object = $objects;
$i=0;
foreach ($object as $items) {
    $json = json_encode($items);
    $objects = json_decode($json,TRUE);
    $object = $objects;
    $i=0;
    foreach ($object as $items) {
        $item[$i] = $items;
        $i++;
    }
}
$entries = $item[5];
foreach ($entries as $entry) {
    echo '<a href="'.$entry["guid"].'">', substr($entry["title"], 0, 50), '...</a><br /><span>', substr($entry["pubDate"], 4, 18),'</span><br /><hr /><br />';
}   
?>

我的问题是 1) 为什么要直播,2) 有没有更好的方法可以做到这一点?

更新

好的,我已经拉出了错误日志,这就是我得到的:

[

2012年6月25日星期一 03:08:20][调试] mod_deflate.c(615):[客户端74.192.47.34] Zlib:压缩0到2:URL/*/*/xmlFeed.php(*由我添加)

所以......这是一个压缩问题?这是什么意思,我能做什么?

试试这个,它会起作用。

<?php
$xml_url = "http://fbrss.com/f/7f823b5ba0557decbd324199136326ac_7LpQh7MAJ22MISS1omjI.xml";
$xml = simplexml_load_file($xml_url);
foreach ($xml->channel->item as $item) {
    echo '<a href="'.$item->guid.'">', substr($item->title, 0, 50), '...</a><br /><span>', substr($item->pubDate, 4, 18),'</span><br /><hr /><br />';
}
?>

简短,甜美,简单。