Hi I have a script to download images using url. The url is in csv file. There are a lot of images which need to be downloaded at least 200k. The problem is when downloading some images it has permission denied issue. I have no problem with that if the image have permission issue I dont want to download but it makes the php script too slow. It takes lots of time to download images. Any suggestion how to download images faster and avoid images which has permission denied issue. Is downloading images with python is more faster than php. Below is the code i use to download images.
<?php
$csv_file = 'bags_import_images.csv';
$handle = fopen($csv_file, "r");
$destination = 'images_import/';
$time = 0;
if ($handle) {
while ($columns = fgetcsv($handle)) {
foreach ($columns as $imageUrl)
{
if (!empty($imageUrl))
{
file_put_contents(
$destination. basename($imageUrl),
file_get_contents($imageUrl)
);
}
echo $time++;
}
}
}
?>