I'm scraping some data from a website using QueryPath. However, every so often I receive the error message below and the script terminates.
PHP Catchable fatal error: Argument 1 passed to DOMXPath::__construct() must be an instance of DOMDocument, null given, called in ....inc/QueryPath/QueryPath/CSS/DOMTraverser.php on line 417 and defined in ....inc/QueryPath/QueryPath/CSS/DOMTraverser.php on line 467
The error doesn't give me any clues as to which line of my code the error is coming from, but assuming it was coming from $outHtml = htmlqp($outHtml);
I tried prefixing the htmlqp command with @htmlqp
.
This didn't work, so I then tried wrapping htmlqp in a catch{} statement which didn't seem to help either.
All I want to do is ignore the error and continue rather than having the script bomb out. Help!