Answer the question
In order to leave comments, you need to log in
How to optimize a curl request to download a lot of pictures in 1 connection?
$images = [' https://hostname/image-1.jpg ', ' https://hostname/image-2.jpg ', ... ' https://hostname/image-1800.jpg '];
$ch = curl_init($images[0]);
$fp = fopen("./images/{$i}", 'wb'); // save the image to my server
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question