Creating the Image-Capturing Webbot
This example webbot relies on a library called LIB_download_images
, which is available from this book's website. This library contains the following functions:
download_binary_file()
, which safely downloads image filesmkpath()
, which makes directory structures on your hard drivedownload_images_for_page()
, which downloads all the images on a page
Figure 8-2. Re-creating a file structure for stored images
For clarity, I will break down this library into highlights and accompanying explanations.
The first script (Listing 8-1) shows the main webbot used in Figure 8-1 and Figure 8-2.
include("LIB_download_images.php"); ...
Get Webbots, Spiders, and Screen Scrapers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.