Page 1 of 1

Save generated XML to the server

Posted: Tue Feb 06, 2007 1:17 pm
by elHelgo
I want to be able to generate an XML document, and then save it as a .xml file to the server. In general, here's what I'm trying to produce:

Code: Select all

$xml_code = '<?xml version="1.0" encoding="UTF-8"?>';
$xml_code = $xml_code . '<gallery>';
$xml_code = $xml_code . '<album id="bouldering" title="Bouldering" lgPath="comphotos/bouldering/">';
$xml_code = $xml_code . '<img src="125Bouldering04.jpg" caption="This where your photo caption would be" />';
... and so on ...

After the xml is complete, I want to be able to save $xml_code as images.xml and have it uploaded to my server.

Many thanks are in advance for helping me solve my problem.

Thanks.

Posted: Tue Feb 06, 2007 1:26 pm
by volka
elHelgo wrote:and have it uploaded to my server
where's the php script running? Another server?
Maybe you're looking for http://de3.php.net/file_put_contents

Sort of ...

Posted: Tue Feb 06, 2007 2:07 pm
by elHelgo
That's exactly what I'm looking for except that I'm running version 4.3.2. I need something that will do that, but could work on an older version.

The php script will be running on the same server as the .xml file. I think I know how to save it to the server, I just need to know how to create the .xls file and write the xml data to it.

Thanks for the quick response though.

Posted: Tue Feb 06, 2007 5:33 pm
by feyd
The manual page linked by volka has user comments that should give details of how to use the function in older versions of PHP..