Answer the question
In order to leave comments, you need to log in
How to avoid errors when using load_file() function in SIMPLE HTML DOM?
I use the Simple HTML DOM library for parsing. The load_file() function is known to work based on file_get_contentns().
There are store pages that load extremely slowly (just some buggy section), resulting in a warning:
Failed to Open Stream: HTTP request failed.
The warning itself is not a problem, let it be. It's just that you can't apply find() to an empty object, it's already "fatal" there.
How to correctly check the validity of the loaded $html content?
I tried this option:
foreach ($item as $link) {
$html = new simple_html_dom;
$html -> load_file($link);
if ($html->root !== NULL) { парсим }
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question