首页 > 解决方案 > 从页面获取img时节点列表为空

问题描述

我正在使用"fabpot/goutte": "^4.0",并想从以下页面获取图像:

在此处输入图像描述

我尝试了以下方法:

use Goutte\Client;
use Symfony\Component\DomCrawler\Crawler;


$content = $client->request('GET', "https://www.laststicker.com/cards/panini_fifa_womens_world_cup_2019/1/")->html();
$crawler = new Crawler($content, null, null);

$imgUrls = [];
$crawler->filter('#content > table > tbody > tr > td:nth-child(1) > div:nth-child(1) > img')->each(function ($link) use (&$imgUrls) {
    array_push($imgUrls, $link->attr('src'));
});

我得到:The current node list is emtpy

有什么建议我做错了吗?

标签: phpgoutte

解决方案


推荐阅读