将元素从其他网站添加到 RSS 源中


Adding elements into an RSS feed from another website?

所以我目前正在 http://www.footballwebpages.co.uk/league.xml?comp=1 获取此 RSS 提要,但根元素不受支持,所以我需要在 XML 文件的底部/顶部添加一个 <rss> 标签。我该怎么做呢?我已经设法在这里打印出来了...

<?php
    header("Content-type: application/xhtml+xml");  
    $html = file_get_contents('http://www.footballwebpages.co.uk/league.xml?comp=1');
        echo $html;
?>

除了底部和顶部的<rss>标签外,它正确地为我提供了所有内容。

不确定这是否是最好的方法,但用<leagueTable>炸毁$html?

header("Content-type: application/xhtml+xml");  
$html = explode("<leagueTable>", file_get_contents('http://www.footballwebpages.co.uk/league.xml?comp=1'));
$html = "<?xml version='1.0' encoding='UTF-8' ?>
<rss>
<leagueTable>{$html[1]}
</rss>";
echo $html;