why open a socket to the page, just use:
$page=file("http://url.com/");
Unless of course you neet to send special stuff like post data or something.
Either way, get the page into an array, and then do:
$page=implode("DMO1",$page);
$page=eregi_replace("<html>","",$page);
$page=eregi_replace("<body","<none",$page);
$page=explode("DMO1",$page);
I am not sure if you will have to escape the <>
After that , the array $page will not contain <html> or <body> tags.