I want to execute a PHP script and create a XML file. The PHP script contains a set of 'echo' commands.
$name = strftime('xml_%m_%d_%Y.xml');
header('Content-Disposition: attachment;filename=' . $name);
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
echo '<lager>'.PHP_EOL;
foreach ($product_array as $product) {
echo "<product>".PHP_EOL;
echo "<code>", $product->var_code, "</code>".PHP_EOL;
echo "<group>", $product->var_group, "</group>".PHP_EOL;
echo "<manu>", $product->var_manufacturer, "</manu>".PHP_EOL;
echo "<product>".PHP_EOL;
}
echo '</lager>'.PHP_EOL;
I already did but with this script, the Browser starts to download a file. Instead of that, I want the script to create file and keep at the server.