Hello...
I am trying to get a piece of XML into my PHP and since the server has short_open_tag = on (it's hosted and they won't change it) it seems to not want to recognize the <?xml part.
Does anyone know of a work around? other than changing hosts.
<?php
if (isset($_SERVER["HTTP_ACCEPT"])
and stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
header("Content-type: application/xhtml+xml");
}
else {
header("Content-type: text/html");
}
?>
[B]<?xml version="1.0"?>[/B]
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>Brew-Monkey.com</title>
<link>[url]http://www.brew-monkey.com[/url]</link>
<description>Your source for brew news, event and competition schedules, beer forums, reviews, and all things beer.</description>
<language>en-us</language>
<copyright>Copyright 2003-2004, Brew-Monkey.com</copyright>
<managingEditor>admin@brew-monkey.com</managingEditor>
<webMaster>admin@brew-monkey.com</webMaster>
<?php
connection stuff...
$result="SELECT UNIX_TIMESTAMP(news_date) as news_date, news_id, news_title, news_snippet "
."FROM bm_news "
."ORDER BY news_date DESC "
."LIMIT 10";
$hStmt = mysql_query($result);
while ($row = mysql_fetch_assoc($hStmt)) {
$title = strip_tags($row['news_title']);
echo "<item>"
."<title>$title</title>"
."<link>[url]http://www.brew-monkey.com/news.php?id=[/url]{$row['news_id']}</link>";
echo "<description>";
$body = strip_tags($row['news_snippet']);
echo (strlen($body) > 255)
? substr($body, 0, 255)." ..."
: $body;
echo "</description>"
."<pubDate>".date("r", $row['news_date'])."</pubDate>"
."</item>";
}
?>
</channel>
</rss>