To get content in the body tag, I'm using the code below.
$html = @file_get_contents($url);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$nodes = $doc->getElementsByTagName('body');
$body = $nodes->item(0)->nodeValue;
How to remove js codes from the $body? Any js code that will look like
<script>
/*Some js code*/
</script>