For creating xml-files I use the DOMObject. But all the created xml-files are big and would cause a heavy bandwidth.
This is the way I save the xml-file
$xml->save($filename);
How could I add a gzip compression?
EDIT: This snippet doesn't work because it creates an empty file
$gz = gzopen($filename,'w');
gzwrite($gz, $xml);
gzclose($gz);