How to download all images from a website?

I want to download several images from the following website: www.bbc.co.uk I want to do this using PHP cURL, can anyone help lead me in the right direction?

It would be nice to upload all the images in one shot, but if someone can help me download, maybe download only 1 or a bunch, which would be great!

Edit: It would be nice to show that I tried:

<?php
$image_url = "www.bbc.co.uk";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);
curl_close($ch);

// output to browser
header("Content-type: image/jpeg");
print $image;
?>

For some reason it does not work. It should be noted that I am an absolute fan of PHP and programming in general.

+3
source share
2 answers

The code above does not do what you think.

$image = curl_exec($ch);

The variable $imagedoes not contain an image; it actually contains all the HTML in this web page as a string.

// output to browser
header("Content-type: image/jpeg");
print $image;

:

var_dump($image);

html.

- :

curl output

.

+2

/Air/assets/images/champions?

FireFox Download, " Them All", FTP ( Eambo), , , .
, , , .

, , :

\League of Legends\rads\projects\lol_air_client\releases\<newest-version>\deploy\assets\images\champions  

, , , , , .

0

All Articles