The problem with that is, of course, that you need to write to a file. This brings in other possible issues such as ensuring you write the file to a location where the user has permissions to do so. A better route is to not write to a file at all. Instead, set the HTML directly...