Reputation: 41
i see in the curl_setopt() documentation that you can set a callback function to display the progress of a curl_exec. There's not much said on how the callback function is used. Does anyone know? I'd just like to output the percentage of the file which has been downloaded to STDOUT. Thanks.
Upvotes: 3
Views: 8002
Reputation: 4487
You get a full example on the curl website at:
http://curl.haxx.se/libcurl/c/curlgtk.html
More complete PHP answer here: cURL Download Progress in PHP not working?
Upvotes: 2
Reputation: 3921
This is how the callback looks in C:
typedef int (*curl_progress_callback)(void *clientp,
double dltotal,
double dlnow,
double ultotal,
double ulnow);
Probably in PHP it should look like
curl_progress_callback($clientp, $dltotal, $dlnow, $ultotal, $ulnow)
I suppose that dl stands for download and ul for upload.
Upvotes: 10