This question already has an answer here:
I'm new in creating RSS with PHP. I have searched some references and it seems that my feeds gets error or invalid RSS based on validator.w3.org. I also has read this link. But it didn't help AT ALL.
I saw that it contains error in line 10 columns 322
. This is the same as I saw in Google Chrome (but not work in mozilla).
The error seems <br><br>
. and, I wonder if RSS doesn't permit any pattern of feed instead of pure texts.
Besides, I use NicEditor
to get article content posted and saved in the database and feed-table.
Here's the feed test link: test_site
Here's my codes to create the RSS in PHP extension:
<?php
include_once('pdo_con.php');
?>
<?php
$qryArtl = $mydb->prepare('SELECT * FROM feeder ORDER BY id DESC');
$qryArtl->execute();
//start creating RSS
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<channel>
<title>Rama Academy: Solusi Belajar Efektif dengan Zenius
Education</title>
<link>http://www.blabla.com/</link>
<description>Cara Belajar Santai, Efektif dan Efisien dengan Zenius
Learning Revolution | Ramaacademy.com - (C) 2015</description>
<language>en-us</language>";
$varA = $qryArtl->fetchAll();
foreach ($varA as $displvarA) {
$contID=$displvarA['id'];
$linkz=$displvarA['link'];
$deskripsi_rss=$displvarA['description'];
$titlejudul=$displvarA['title'];
//grab the content
$title=$displvarA['title'];
$link=$displvarA['link'];
$description=$displvarA['description'];
echo "<item>
<title>$titlejudul</title>
<link>$linkz</link>
<description>$deskripsi_rss</description>
</item>";
}
echo "</channel></rss>";
?>
This following text is just a sample I fetch from google:
You've moved your site to a new domain, and you want to make the
transition as seamless as possible.
People access your site through several different URLs. If, for
example, your home page can be reached in multiple ways - for instance,
http://example.com/home, http://home.example.com, or
http://www.example.com - it's a good idea to pick one of those URLs as
your preferred (canonical) destination, and use 301 redirects to send
traffic from the other URLs to your preferred URL. You can also use
Webmaster Tools to set your preferred domain.
My QUESTION IS: Is the HTML format causes the Error? If it is, How can I make it validated RSS? and, please suggest me the better one if available. Thanks for help!
</div>