Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to Create RSS Feed For Website using PHP

php mysql
How to Create RSS Feed For Website using PHP

Nowadays, most website owners are sharing their site content using social media. So, many Facebook, Twitter, Google plus or other social media users are using the stream of their favorite social network to remain aware of website changes. Nevertheless, RSS remains the first choice for content syndication. You may also like How to create RSS Feed reader using PHP.

In this tutorial we will show you how to create RSS Feed for dynamic website using PHP.

PHP Code


define('DB_SERVER', "localhost");
define('DB_USER', "root");
define('DB_PASS', "");
define('DB_DATABASE', "hd_blog");
$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);

$sql = "SELECT * FROM tbl_add_post ORDER BY id ";
$query = mysqli_query($con, $sql);

header("Content-type: text/xml");

echo "<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<title>  - Programming Blog</title>
<link> </link>
<description>Programming Blog</description>

while ($row = mysqli_fetch_assoc($query)) {
    $title = $row['title'];
    $link = $row['slug'];
    $description = $row['meta_description'];

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


Html code work in comment box

Related Post