$url = "https://www.example.com"; $html = file_get_html($url); $document = $html->getDocument(); echo $document->plaintext;
$document = new DOMDocument(); $document->loadHTML($html); echo $document->getElementsByTagName('title')->item(0)->nodeValue;This code uses the DOMDocument class to create an HTML document object and then loads the HTML content. It then extracts the title tag from the document using getElementsByTagName. Package library: PHP DOM Extension