str_get_html is not loading a valid html string

前端 未结 3 654
灰色年华
灰色年华 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 22:11

    I asume that you are using curl + str_get_html instead of simply using file_get_html with the URL because of the POST parameters you need to send.

    You can use this W3C validator (http://validator.w3.org/#validate_by_input+with_options) to validate the returned HTML, then, once you are sure the result is a 100% valid HTML code you can report a bug here: http://sourceforge.net/p/simplehtmldom/bugs/.

提交回复
热议问题