将XSL Feed从一个URL复制到另一个URL

时间:2015-08-08 01:50:10

标签: php rss feed

有一个RSS提要:

www.domain1.com/rss.xsl

我需要将这个xsl feed复制到另一个webhost来制作

www.domain2.com/rsscopy.xsl

我该怎么做?我可以通过PHP做到吗?

谢谢:)

1 个答案:

答案 0 :(得分:0)

您需要使用file_get_contentsfile_put_contents功能。

<?php

$rss = file_get_contents('http://www.domain1.com/rss.xsl');

$filename = 'rssCopy.xsl';
$saveRss = file_put_contents($filename, $rss);

if($saveRss)
{
    echo 'RSS Copied';
}

将上述脚本保存在domain2.com中,然后通过网址进行调用。