PHP que crea un archivo xml
Código PHP:
<?
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
foreach($trans_tbl as $k => $v)
{
$ttr[$v] = utf8_encode($k);
}
$text = strtr($text, $ttr);
if(isset($_POST['dato'])){
$datos = '<?xml version="1.0" encoding="UTF-8"?>
<gallery title="Example Title" frameColor="0xFFFFFF" frameWidth="10" imagePadding="20" displayTime="6">
<image>
<filename>'. $_POST["Nom"] .'</filename>
<caption>'. $_POST["Des"] .'caption>
<width>'. $_POST["W"] .'</width>
<height>'. $_POST["H"] .'</height>
</image>
</gallery>';
$archy= $_POST["dato"];
$file = fopen($archy,"w-");
fwrite($file,utf8_encode($datos));fclose($file);
header("Location: oksend.htm");
}
else
{
echo "output=no se han recibido los datos";
}
?>
XML a crear
Código PHP:
<?xml version="1.0" encoding="UTF-8"?>
<gallery title="Example Title" frameColor="0xFFFFFF" frameWidth="10" imagePadding="20" displayTime="6">
<image>
<filename>example.jpg</filename>
<caption>foto 10001.</caption>
<width>640</width>
<height>480</height>
</image>
<image>
<filename>example.jpg</filename>
<caption>foto 10002.</caption>
<width>640</width>
<height>480</height>
</image>
<image>
<filename>example.jpg</filename>
<caption>foto 10003.</caption>
<width>640</width>
<height>480</height>
</image>
<image>
<filename>example.jpg</filename>
<caption>foto 10004.</caption>
<width>640</width>
<height>480</height>
</image>
</gallery>