所以我有一个致命的问题。我无法显示此 xml 数据。它在 3 个月前可以工作,现在不行了。任何修复这个虫子的建议都会帮助我很多!
是的 - 我已经检查了链接是否有效,并且有效。
<?php
if(file_exists('http://blog.millcitychurch.org/blog/rss.xml')){ ?>
<h1>// THE LATEST FROM MILL city</h1>
<div class="feed">
<?php
$xml = file_get_contents('http://blog.millcitychurch.org/blog/rss.xml');
$url = 'http://blog.millcitychurch.org/blog/rss.xml';
$rss = simplexml_load_file($xml);
if($rss) {
$items = $rss->channel->item;
$i = 0;
foreach($items as $item) {
if (++$i > 4) {
// stop after 5 loops
break;
}
$title = $item->title;
$link = $item->link;
$published_on = $item->pubDate;
$description = strip_tags($item->description);
$position=215; // Define how many character you want to display.
$message = $description;
$post_content = substr($message, $position, 1);
$post_content = substr($message,0,$position); // Display your message
echo '<div class="feed-desc">' ;
echo '<h2>'.$title.'</h2><p>';
echo $post_content;
echo '</p><div class="readmore"><a href="'.$link.'">... read more</a></div>';
echo '<div class="date">'.$published_on.'</div>';
echo '</div>';
}
} ?>
</div><! -- end .feed -->
<?php } ?>