应该适用于任何网址的简单代码(我认为):
我不知道为什么我会收到以下警告。任何想法 ?
PHP 警告:DOMDocument::saveHTML(): output conversion failed due to conv error, bytes 0xE9 0x74 0xC3 0xA9 in ********.php on line 9
$content = file_get_contents('http://www.ludibay.net/');
$encoding = mb_detect_encoding($content);
$doc = new DomDocument();
$res = @$doc->loadHTML('<?xml encoding="'.$encoding.'">'.$content);
//some treatment on nodes here
echo $doc->saveHTML();