It's possible. An HTML file is a file ('course, in the Unix world, anything is a file, so maybe that's not saying much); so the file functions (like fopen() and fwrite()) are potentially good candidates. There may be something better though...
Check out the output buffering functions (like ob_start() and its ilk), the scenario goes like this. Start output buffering, create the HTML page the same way as you normally would (exactly as if you were sending it to a browser), then use one of the other ob_* functions (whose name escapes me for the moment) to collect all this buffered output into a variable. Create a new HTML file with some appropriate name, and write the contents of the variable into it. Go on to the next file.
This is likely to take a while, what with 7000 files and all to write, so set_time_limit() will probably come in handy.