当前节点列表是空的php抓取

时间:2016-11-22 05:45:42

标签: php goutte domcrawler

我在从页面获取图片时遇到问题。有些页面有些没有。在那些没有我得到current node list is empty错误。

我正在做!empty($crawler->filter('.listing-logo > img')->attr('src'))但它仍然会返回异常。

我已尝试使用->count()进行此操作,但它不允许使用字符串。我还使用了strlen,但它仍然发回空。

$client = new Goutte\Client();
        $crawler = $client->request('GET', $item->data['child']['']['guid'][0]['data']);
dd(!empty($crawler->filter('.listing-logo > img')->attr('src')));

0 个答案:

没有答案
相关问题