Organizational Research By

Surprising Reserch Topic

Google Chrome rendering XML as text for RSS feed


I have this script to generate an XML file for an RSS feed. Works great in every browser except Chrome. Chrome just renders the XML as text. Something to do with header("Content-Type: application/rss+xml; charset=ISO-8859-1"); possibly?

This is the code I'm using:


$linkUp = "http://localhost/sites/myBlog/";

header("Content-Type: application/rss+xml; charset=ISO-8859-1");

$rssfeed  = '';
$rssfeed .= '';
$rssfeed .= '';
$rssfeed .= 'Mytitle';
$rssfeed .= '' . $linkUp . '';
$rssfeed .= 'Mydescription';
$rssfeed .= 'en-us';
$rssfeed .= '© ' . strftime('%Y') .  ' . " " . ' . $linkUp . '';

$query = "SELECT * FROM rss";
$result = $db->query($query);

while($row = $db->fetch_array($result)) {

    $rssfeed .= '';
    $rssfeed .= '' . $row['rss_title'] . '';
    $rssfeed .= '' . $row['rss_description'] . '';
    $rssfeed .= '' . $row['rss_link'] . '';
    $rssfeed .= '' . date("D, d M Y H:i:s O", strtotime($date)) . '';
    $rssfeed .= '
';
}

$rssfeed .= '
';
$rssfeed .= '
';

echo $rssfeed;

?>

asked May 7, 2015 in google by rajesh
0 votes
16 views



Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

...