douruye5092 2011-09-06 13:46 采纳率: 100%
浏览 35

从单个网页下载所有图像

I'm experimenting with PHP, and I've just asked myself a question. How can I download all images from a single website? Let's say that I wanted and images from cnn.com or any other website. Is there any easy way I can download all the images using PHP, and save them on my local computer (or FTP server).

Any help would be appreciated.

  • 写回答

2条回答 默认 最新

  • duanlei2458 2011-09-06 13:48
    关注

    If you wanted just all download all images referenced by img elements.

    1. Request the remote file with something like cURL.
    2. Use a DOM parser (such as DOMDocument) to get all img element.
    3. Iterate over the img elements and use cURL (or similar) to download each image (check the src attribute).
    评论

报告相同问题?

悬赏问题

  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式