str_get_html is not loading a valid html string

前端 未结 3 653
灰色年华
灰色年华 2021-02-07 21:13

I receive an html string using curl:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$html_string = curl_exec($ch);

When I echo it

3条回答
  •  别那么骄傲
    2021-02-07 21:51

    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.

提交回复
热议问题