- file_get_contents: documentation ( source)
- mb_detect_encoding: documentation ( source)
- libxml_use_internal_errors: documentation ( source)
<?php
$content = file_get_contents('http://www.ludibay.net/');
libxml_use_internal_errors(true);
$encoding = mb_detect_encoding($content);
$doc = new \DomDocument();
$res = $doc->loadHTML($content);
//some treatment on nodes here
echo $doc->saveHTML();