Me muestra este error:
Declaración xml no válida.
, línea: 4, carácter: 3
<?xml version="1.0" encoding="iso-8859-1" ?>
No se bien porque, lo tengo armando con un php asi:
Código PHP:
<?php
header("Content-Type: text/xml");
include "conexion.php";
$query = mysql_query("SELECT * FROM fb");
$listado = mysql_fetch_array($query);
//un array "listado"
//Volcamos el rss
echo '<?xml version="1.0" encoding="iso-8859-1" ?>';
echo "\n";
echo '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/">';
echo "\n";
echo "\t<channel>\n\t<title>TITULO DE LA WEB</title>\n\t<link>http://www.dominio.com</link>\n\t<language>es-ES</language>\n\t<description>Descripcion de la web.</description>\n";
foreach($listado as $item) {
echo "\t\t<item>\n";
echo "\t\t\t<title><![CDATA[".$item['titulo']."]]></title>\n";
echo "\t\t\t<link>http://www.dominio.com/".$item['id']."</link>\n";
echo "\t\t\t<description><![CDATA[".$item['descripcion']."</description>\n";
echo "\t\t\t<content:encoded><![CDATA[".$item['descripcion']."]]></content:encoded>\n";
echo "\t\t\t<pubDate>".date("r",strtotime($item['fecha']))."</pubDate>\n";
echo "\t\t\t<guid>http://www.dominio.com/".$item['id']."</guid>\n";
echo "\t\t</item>\n";
}
echo "\t</channel>\n</rss>";
?>