Check cURL progress

Is there a way to check the status of the curl command? Say I have a php hang call, using exec to initiate it. Is there a way to check the progress while it is running? Or do I need to wait for the end?

exec ("curl $ url -k> / dev / null 2> & 1 &");

+5
source share
1 answer

You can define the progress function:

curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, 'my_progress_handler');

The name of the callback function, where the callback function takes three parameters. The first is the cURL resource, the second is the file descriptor resource, and the third is the length. Return a string containing data.

For more information see here .

: PHP.

exec(), . , .
: , , , nevermind

, popen(), curl , .

-# curl, , .

+4

All Articles