duanba3707 2019-06-25 11:00
浏览 23

如何使用goutte废弃div标签内的背景图像

hey friends i am trying to scrap flipkart image using goutte but the problem is that the image url is inside style tag of div. i tried several way to scrap image but i failed. hope you guys will help me ....

Here is the code that i had tried..

$output = $crawler->filter('img[class="_3togXc _3wp706"]')->each(function ($node) {
      print_r($node);

    echo '<img src="' . $node->attr('src') . '" alt="' . $node->attr('alt') . '">';
});

var_dump($output);

and the image is inside this div tag ...

<div class="_2_AcLJ _3_yGjX" style="background-image:url(https://rukminim1.flixcart.com/image/128/128/jwnusnk0/shoe/g/g/4/combo-3-1206-1077-1197-6-shoefly-multicolor-original-imaf9zgwfbgeb6vw.jpeg?q=70)"></div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)