Hi fellow developers,
I'm having a real problem at the moment, I'm trying to capture everything in between <body></body> tags using the following code but it does not print anything:
$lines = file("http://www.bbc.co.uk/");
foreach ($lines as $line_num => $line) {
$thecontent .= htmlspecialchars($line) . "<br />\n";
}
preg_match('/<body.?>(.?)<\/body >/', $thecontent, $htmltext);
$moretext = $htmltext[1];
echo $moretext;
When you do place a "print($thecontent);" into the code the entire html for [whatever the website] does display but I want to capture only the html code in between the body tags. I've tried everything but I just can't get this to work. :queasy:
I would appreciate anyone's help and I'd like to thank you in advance.
M