This is great. Thanks for posting it. I can't seem to get it to work though. There are some funky characters in here when I try to cut and paste the code. I assume probably because you had to do that to get the code to display properly here rather than have the page process the code. Also there seems to be a big problem around here:
$pattern = ‘/<[^<]*)*<\/body>/'; ([^<]*
Do you mind posting the actual .php file or emailing it to me? Thanks!