Fair enough. This is actually easily fixable. You just have to replace a bit of code.
$string = readline TEST;
$string .= $_ ;
There. Now you've merged separate lines into a single string to search, and this works again. Happy?
Edit:Oh, and if you're still missing an ending iframe tag, you can see if that exists in your while loop condition text. Heck, you could probably tell the user where they're missing a iframe tag if you took that idea a little furhter.