Page 1 of 1

create xml document from php

Posted: Sat Feb 06, 2010 2:16 am
by deepcover
Hi

I know that this question have been asked many times before, but I can't seem to find the exact answer for my need.

What is the best way to create a xml document from php?

I have read about several solutions, some does not actually create the file but only shows the xml code on the screen, I think I need a fysical xml file because i need to use the data in actionscript later on.
Then there's DOM which I can't figure out if I am supposed to install on my server(not my own server, just some random standard web server) or how it is used.

Hope someone can clear things up for me.

Thanks
Deepcover

Re: create xml document from php

Posted: Sat Feb 06, 2010 4:18 am
by Grizzzzzzzzzz
if you're getting the entire XML written on the screen, then you're already 99% of the way there.


Simply take the string that's being outputted, and write it to a file

Code: Select all

 
$myFile = "test.xml";
$fh = fopen($myFile, 'w');
$stringData = "alllllllll your XML";
fwrite($fh, $stringData);
fclose($fh);