Estoy tratando de escribir un canal RSS muy simple que muestre la tira cómica del día actual de sinfest.net, pero no puedo obligarlo a mostrar nada más que el título vinculado. enlace a una de las versiones de código:¿Cómo mostrar la imagen en RSS?
<?php
$page = file_get_contents('http://www.sinfest.net/index.php');
$title = '';
$description = '';
$link = '';
$date = date("Y-m-d");
if (preg_match('~<img src="(http://sinfest\\.net/comikaze/comics/.*\\.gif)" alt="(.*)" border="0" />~isU', $page, $match)) {
$title = $match[2];
$description = "<img src='{$match[1]}'/>";
}
if (preg_match('~<a href="http://sinfest\\.net/archive_page\\.php\\?comicID=([0-9]*)"><img src="images/prev_a.gif"~isU', $page, $match)) {
$link = 'http://sinfest.net/archive_page.php?comicID=' . ($match[1]+1);
}
$ok = $title && $description && $link;
$image = "http://www.sinfest.net/comikaze/comics/" . $date . ".gif";
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>';
echo '<rss version="2.0">
<channel>
<title>Latest Sinfest</title>
<link>http://www.sinfest.net/</link>
<description>Latest Sinfest</description>
<image>
<url>' . $image . '</url>
<title>' . htmlspecialchars($title) . '</title>
<link>' . htmlspecialchars($link) . '</link>
</image>';
if ($ok):
echo ' <item>
<title>' . htmlspecialchars($title) . '</title>
<link>' . htmlspecialchars($link) . '</link>
<description><img src="' . $image . '" /></description>
<enclosure url="' . $image . '" type="image/jpeg" />
</item>';
elseif (!isset($_GET['noerror'])):
echo ' <item>
<title>Error parsing news.' . date('Y-m-d H:i:s') . '</title>
<link>about:blank</link>
<description>Error parsing news.</description>
</item>';
endif;
echo ' </channel>
</rss>';
?>
El código-RSS solamente (no me quito las variables de PHP):
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
<title>Latest Sinfest</title>
<link>http://www.sinfest.net/</link>
<description>Latest Sinfest</description>
<image>
<url>' . $image . '</url>
<title>' . htmlspecialchars($title) . '</title>
<link>' . htmlspecialchars($link) . '</link>
</image>
<item>
<title>' . htmlspecialchars($title) . '</title>
<link>' . htmlspecialchars($link) . '</link>
<description><img src="' . $image . '" /></description>
<enclosure url="' . $image . '" type="image/jpeg" />
</item>
</channel>
</rss>
Cualquier idea de lo que estoy haciendo mal y alguna pieza de consejo tal vez? Gracias es avance.
favor incluya el código en la pregunta. Tener que descargar un archivo comprimido y extraerlo es demasiado esfuerzo y corre el riesgo de perder una parte importante del contenido para el futuro. ... el sitio de descarga tampoco parece funcionar. El "enlace" obvio no es un enlace. – Quentin
Lo siento, me olvidé de esa posibilidad. – brovar
Intente mostrarnos el RSS, no el PHP. Es el RSS con el que tienes problemas, ¿no? – Quentin