Hallo,
ich habe für meine Website ein PHP-Script erstellt, das beim Laden der Startseite ein aktuelles RSS-Feed erzeugt. Mein Problem: Die XML-Datei stimmt, aber der RSS-Reader zeigt das Feed leer an.
Hier mein Code:
<?php
include 'config.php';
function mkRSS() {
$datei = "html/admin/rss.xml";
$handler = fOpen($datei, "w+");
fWrite($handler,"<?xml version='1.0' encoding='ISO-8859-1'?>\n");
fWrite($handler,"<rss version='2.0'>\n");
fWrite($handler,"<channel>\n");
fWrite($handler,"<title>News</title>\n");
fWrite($handler,"<link>http://meine-seite.de/</link>\n");
fWrite($handler,"<description>Mein Newsfeed</description>\n");
fWrite($handler,"<language>de-de</language>\n");
$db_link = @mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS);
mysql_select_db(MYSQL_DB,$db_link);
$query = "SELECT * FROM articles WHERE category = 'News' OR startpage = '1' ORDER BY date DESC";
$res = mysql_query($query);
while($row = mysql_fetch_array($res)) {
$id = $row['id'];
$author = base64_decode($row['author']);
$subject = $row['subject'];
$date = $row['date'];
$intro = $row['intro'];
$body = $row['body'];
fWrite($handler,"<item>\n");
fWrite($handler,"<title>$subject</title>\n");
fWrite($handler,"<description>$intro</description>\n");
fWrite($handler,"<link>http://link-zum-Beitrag.de</link>\n");
fWrite($handler,"<pubDate>$date</pubDate>\n");
fWrite($handler,"</item>\n");
}
fWrite ($handler,"</channel>\n");
fWrite ($handler,"</rss>");
fClose($handler);
}
?>
Schon mal Danke für eurer Hilfe.
Nemesis