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);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$image = curl_exec($ch);
curl_close($ch);
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.
Navee source
share