I receive an html string using curl:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $html_string = curl_exec($ch);
When I echo it
echo
Did you check if the HTML is somehow encoded in a way HTML DOM PARSER doesn't expect? E.g. with HTML entities like <html> instead of – that would still be displayed as correct HTML in your browser but wouldn't parse.
<html>