EGN
EGN

Reputation: 2592

php curl download stops at 95%

this is very weird, php curl download stops at 95% all the time. its driving me crazy.

here is the code that i'm using nothing fancy

$fp = fopen($file, 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.domain.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_HTTPHEADER,array("ETag: $rddash"));

curl_setopt($ch, CURLOPT_FILE, $fp);

curl_exec($ch);

curl_close($ch);
fclose($fp);

Something i noticed, the remote website is using Etag, so i used it but still not working.

what could be the reason the download stops before it completes??

Upvotes: 0

Views: 293

Answers (1)

gopi1410
gopi1410

Reputation: 6625

Maybe a timeout issue in your php.ini settings. Use set_time_limit(0); in your code.

See the manual for more details.

Also check the PHP error log.

Upvotes: 3

Related Questions