php - 从页面获取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
有什么建议我做错了吗?
解决方案
推荐阅读
- swift - UISwipeGestureRecognizer.Direction.down
- javascript - 无法在 ReactJs 应用程序中导入 css
- qt - 如何从 QDialog 刷新/更新/重绘 QMainWindow?
- c# - 获取与指定模式不匹配的组
- ios - 如何使用自动布局动态设置文本视图高度
- python - 网状:无法配置python3
- android - 我们如何在android studio中集成sonarqube(gradle版本在3以上)?
- python - Python 视频未播放使用请求模块下载
- swift - 这是 Swift 中的什么函数?
- laravel - 由于 laravel 在上传两张图片时出现未知错误,文件“image.jpg”未上传