Page 1 of 1
php making xml (rss/rdf)
Posted: Mon Jun 24, 2002 3:16 am
by kaizix
i'm trying to make php output a xml (rss/rdf) file....i don't want it to parse it but rather, to write it...is there a way i can? i haven't figured out how to make it work....are there special functions i need to use? can anyone help?
Posted: Mon Jun 24, 2002 4:39 am
by MattF
If you want to just create a XML page it is very simple, I have a page that dumps a database table to XML, here is the code:
Code: Select all
<?php
header('Content-type: text/xml');
echo "<?xml version="1.0"?>\n";
echo "<content>\n\n";
$r = mysql_query("SELECT * FROM " . $tblї'content']);
while($q = mysql_fetch_array($r,MYSQL_ASSOC))
{
echo "<article>\n";
foreach($q as $tag => $value)
{
$value= htmlspecialchars($value);
echo "<$tag>$value</$tag>\n";
}
echo "</article>\n\n";
}
echo "\n\n</content>";
?>
Posted: Mon Jun 24, 2002 4:43 am
by kaizix
ah, that's what i was missing...the header description.....thanks a bunch.
XMl/XSL parsing
Posted: Tue Jul 16, 2002 4:58 am
by Guest
Hi,
I am new to PHP with XMl/XSL. Care to tell me how I can parse a XML page instead?
I have tries searching and reading the PHP helpfiles but still cannot understand and find a solution.
Please help. Thanks in advance.
[/list]
look this
Posted: Tue Jul 16, 2002 4:51 pm
by AVATAr