Laney
Member
Registered: 6th May 03
Location: Leeds
User status: Offline
|
Am I right in thinking that you can't parse XML to the browser using PHP?
Basically I want to output data from a database into an XML format instead of regular HTML. I've googled it but the only suggestion is to create a new XML document each time. Is this the way I should be thinking?
|
James
Member
Registered: 1st Jun 02
Location: Surrey
User status: Offline
|
SQL can output in XML directly without using PHP.
http://www.topxml.com/sql/for_xml_explicit.asp
|
Laney
Member
Registered: 6th May 03
Location: Leeds
User status: Offline
|
That looks a bit complicated
For future reference, this was just what I was looking for: http://www.builderau.com.au/program/php/soa/Dynamic-XML-document-construction-with-the-PHP-DOM/0,339028448,339273222,00.htm Stupid google
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
Can you not just use the header() function?
You're just spoofing the MIME type, right? Apologies if there is more to it that I'm missing but that would be my starting point.
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
Check the source of this
http://www.corsasport.co.uk/board/rssads.php
Thats just a regular database query but instead of printing HTML code around the data its got RSS XML.
I can give you the PHP source to that if you want but there really was no science bit, just header() and the echos in the right places.
[Edited on 26-04-2007 by Ian]
|
Laney
Member
Registered: 6th May 03
Location: Leeds
User status: Offline
|
Awesome Thanks Ian.
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
Worth noting that it was a bit of a hack and doesn't probably conform to any specs, I just looked at some other feeds and made mine the same.
|