how to render a view and save the content in a file in Laravel
I found the problem, on top of the template file was a line that said
<?php header('Content-type: text/xml'); ?>
That caused the script to output to the browser, without asking for it. The template was written by someone else so I didn't know about it, but surely I should have checked it before asking