0

The second page on the curl cant open because I try to fetch big file. When the proccess in first page finish, second page opens. How can I solve that without using curl_multi_exec. upload.php:

$curl = curl_init('http://example.com/upload.php');
$curlopt[CURLOPT_SSL_VERIFYHOST] = true;
$curlopt[CURLOPT_POST] = true;
$curlopt[CURLOPT_RETURNTRANSFER] = true;
$curlopt[CURLOPT_POSTFIELDS] = array('myfile'=>'@'.$u->file);
$curlopt[CURLOPT_INFILESIZE] = (string)filesize($u->file);
$curlopt[CURLOPT_INFILE] = fopen($u->file,'r');
curl_setopt_array($curl,$curlopt);
curl_exec($curl);
curl_close($curl);

2 Answers2

0

You can set CURLOPT_TIMEOUT option of curl to bigger value inorder not to lose first connection

You can refer here for more option

Hüseyin BABAL
  • 15,400
  • 4
  • 51
  • 73
  • Add my code. When I run the same page twice. expects to finish the first one. I think relevant to Curl session. –  Apr 27 '12 at 14:34
0

This is what i would advice

A. Split large files into chunks : https://stackoverflow.com/a/10271542/1226894

B. Use Multi Curl : https://stackoverflow.com/a/10036599/1226894

Have answered it before and don't think it should be duplicated but let me know if you have any questions

Community
  • 1
  • 1
Baba
  • 94,024
  • 28
  • 166
  • 217