cURL Download Progress in PHP not working?

后端 未结 2 1795
时光取名叫无心
时光取名叫无心 2021-01-01 04:18

I am a PHP newbie and trying to add a progress-bar to an existing PHP script using the following method :

$ch=curl_init() or die(\"ERROR|Error:         


        
2条回答
  •  借酒劲吻你
    2021-01-01 05:08

    Regarding the last comment, said code requires 5.3 because stream_context_create()'s second parameter was added in 5.3. However, replacing that line with the following works in 5.2:

    $ctx = stream_context_create();
    stream_context_set_params($ctx, array("notification" => "stream_notification_callback"));
    

    And in related news, the stream_notification_callback() documentation within the PHP manual has an example that fully utilizes/creates a progress bar, so check it out.

    http://php.net/stream_notification_callback

提交回复
热议问题