Günün çizgi romanını sinfest.net adresinden görüntüleyebilecek çok basit bir RSS kanalı yazmayı deniyorum, ancak onu bağlı başlıktan başka bir şey göstermeye zorlayamıyorum. kod sürümleri birine Bağlantı:RSS'de nasıl görüntü gösteriliyor?
<?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>';
?>
RSS okunur kodu (PHP değişkenleri kaldırmadık):
<?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>
yanlış ve bazı parça ve ne yapıyorum herhangi bir fikir tavsiye belki? Teşekkürler.
söz konusu kodunu ekleyin. Bir zip dosyasını indirip çıkartmak çok fazla çaba gerektiriyor ve gelecekte içeriğin önemli bir bölümünü kaybediyor. … indirme sitesi de çalışmıyor gibi görünüyor. Açık olan "link" bir bağlantı değildir. – Quentin
Üzgünüm, bu olasılığı unuttum. – brovar
Bize RSS'yi göstermeyi deneyin, PHP'yi değil. Sorun yaşadığın RSS bu değil mi? – Quentin