PHP curl_setopt() CURLOPT_PROGRESSFUNCTION

前端 未结 2 543
天涯浪人
天涯浪人 2021-01-14 12:33

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

相关标签:
2条回答
  • 2021-01-14 13:24

    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.

    0 讨论(0)
  • 2021-01-14 13:30

    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?

    0 讨论(0)
提交回复
热议问题