Quelle est la bonne façon de télécharger comme 50+ fichiers PDF en utilisant curl PHP?PHP Curl télécharger des fichiers PDF
Ci-dessous le code que je utilise:
$fp = fopen("test.pdf", 'w');
$ch = curl_init();
curl_setopt($ch,CURLOPT_PROXY,"http://test:123");
curl_setopt($ch,CURLOPT_PROXYPORT,123);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt ($ch, CURLOPT_TIMEOUT, 500);
curl_setopt($ch,CURLOPT_URL,"http://download/test.pdf");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
Le problème est parfois, 2-3 fichiers PDF ne sont pas correctement téléchargés (0-1 octets). Une idée de pourquoi c'est instable? Dois-je inclure autre chose dans le code ci-dessus?
Merci à l'avance