Forum Moderators: rogerd & travelin cat
http://www.mysite.co.uk/index.php/feed http://www.mysite.co.uk/index.php?feed=rss <?php
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$returned_content = get_data('http://www.mysite.co.uk/index.php?feed=rss');
echo $returned_content;
$fp = fopen("feed.txt", "w");
fwrite($fp, $returned_content);
fclose($fp);
?> function NAME_OF_YOUR_FEED() { header('Content-Type: text/xml; charset='.get_option('blog_charset'), true); echo '<?xml version="1.0" encoding="UTF-8"?>'; echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'; echo '<channel>'; <title>Title</title> <link>http://www.example.com/?feed=NAME_OF_YOUR_FEED</link> <atom:link href="http://www.example.com/?feed=NAME_OF_YOUR_FEED" rel="self" type="application/rss+xml" /> // build the feed here with a loop, using query_posts(), or whatever echo '</channel>'; echo '</rss>'; } add_feed('NAME_OF_YOUR_FEED','NAME_OF_YOUR_FEED');