InvalidArgumentException: The current node list is empty. PHP-Spider (DOMCrawler Symfony) InvalidArgumentException: The current node list is empty. PHP-Spider (DOMCrawler Symfony) php php

InvalidArgumentException: The current node list is empty. PHP-Spider (DOMCrawler Symfony)


Yes, count() method can be used for that, like this:

if( $resource->getCrawler()->filterXpath('//title')->count() ){    echo $resource->getCrawler()->filterXpath('//title')->text() . ', ';}