Forum Moderators: coopster

Message Too Old, No Replies

PHP, Mysql and creating an XML file

         

turbohost

4:43 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



Hi guys,

How can I best create an XML file with PHP and Mysql (i want to feed the XML file with content from the Mysql database)?

Thx,
Turbo

vevs

6:17 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



<?
header('Content-type: text/xml; charset=UTF-8', true);
echo '<?xml version="1.0" encoding="UTF-8"?'.'>';
?>
<rss version="2.0"
xmlns:content="http://example.org/rss/1.0/modules/content/"
xmlns:wfw="http://example.org/CommentAPI/"
xmlns:dc="http://example.org/dc/elements/1.1/"
>
<channel>
<title>RSS title</title>
<link>http://www.example.com</link>
<description>some description</description>
<lastBuildDate><? echo date('D, j F Y h:i:s A +0000');?></lastBuildDate>
<language>en</language>

//// build items here
<item>

</item>

</channel>
</rss>

Hope this helps

Regards,Vevs

[edited by: coopster at 8:10 pm (utc) on Jan. 8, 2006]
[edit reason] no urls please [/edit]

turbohost

6:23 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



Thx a lot, it works. I forgot to include the header so I got always an html page instead of an xml page :-)

Turbo

vevs

6:24 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



you are welcome :)

[edited by: coopster at 8:09 pm (utc) on Jan. 8, 2006]
[edit reason] no personal urls please TOS [webmasterworld.com] [/edit]