How to embed rss feeds to html



I have a file rss.php which i thing works fine but i need a way to output the result in my main page in a form that is readable. Any suggestions?


rss.php code



<?php
//rss
header("Content-type: application/xml");
//header("Content-type: text/xml");

//code to connect to db and querry for the results


echo "<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<channel>
<desc>intro</desc>
<date_created></date_created>
<created_by></created_by>";

while($row = mysqli_fetch_array($result)) {
$desc= $row['desc'];
$date_created = $row['date_created'];
$created_by = $row['created_by'];
echo "<item>
<desc> $perigrafi </desc>
<date_created> $date_created </date_created>
<created_by> $created_by </created_by>
</item>";
}

echo"</channel>
</rss>";

mysqli_close($con);
?>

No comments:

Post a Comment