php - Using cURL in a loop -
i'm writing script in unspecified number of files need uploaded via curl requests remote api. however, script hangs , times out. strangely enough, requests successful (the files uploaded), script unable continue. here's loop: foreach ($paths $path) { $ch = curl_init($path); curl_setopt($ch, curlopt_httpheader, array('x-auth-token: '.$token, 'content-length: '.filesize($path)); curl_setopt($ch, curlopt_put, true); curl_setopt($ch, curlopt_infile, fopen($path, 'r')); curl_setopt($ch, curlopt_infilesize, filesize($path)); echo curl_exec($ch); } i believe has loop. i've tried adding curl_close within loop, doesn't solve problem. ideas? put timeout in curl foreach ($paths $path) { $ch = curl_init($path); curl_setopt($ch, curlopt_httpheader, array('x-auth-token: '.$token, 'content-length: '.filesize($path)); curl_setopt($ch, curlopt_put, true); curl_setopt($ch, curlopt_infile, fopen($path, 'r...