Skip to content

Instantly share code, notes, and snippets.

@starlightsys
Last active December 30, 2015 06:29
Show Gist options
  • Save starlightsys/7790010 to your computer and use it in GitHub Desktop.
Save starlightsys/7790010 to your computer and use it in GitHub Desktop.
How to load a UTF-8 HTML document into the PHP DOM.
<?
$dom = new DOMDocument('1.0', 'utf-8');
@$dom->loadHTML( mb_convert_encoding($htmldoc, 'HTML-ENTITIES', 'UTF-8') );
$x = new DOMXPath($dom);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment