I have a simple PHP program that list some topics.
for example I have an array [1] => Red [2] => Green [3] => Blue
and then I want to get pictures of those three using, say Google API
So I will do this
foreach ($array as $arr)
{
echo curl_get_image($arr);
}
So my problem here is that I'm not only have 3 items in the array, it can be 10 or 20 The program run really slowly, I suspect that it is because the program has to wait for each curl request before going to the next curl request.
what is the best way to do this?
or is there any better way like multithreading the curl processes to run each process in parallel?
Thank You