Using curl_multi_perform in batchDownload and improve error handling