如何在浏览器中显示cURL进度条(使用PHP exec()函数)

I'm using this tiny PHP code in order to mirror any files into my server.

<?php
 $cmd= "curl -L -O http://www.dropbox.com/s/8lu0nutt4tgpkku/jbtools.ipa";
 exec($cmd);
?>

But the browser is freezing until the mirroring process gets finished. My question is that how can I display the progress bar like when I run this command in Terminal. something like this:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed

I tried many flags such as:

-v --verbose -I -include --trace -

but none of them worked. I also asked a question here to convert it to a PHP CURL code but no one could help me with that!

If it's not possible, it's really appreciated advising me to do the same job by any other commands.

Easiest way is by polling. Execute the script in the background and direct the output (to a file) that your frontend (js) can poll.

execute in the background with examples: https://felixmilea.com/2014/12/running-bash-commands-background-properly/

showing progress in the shell can be done with piping to pv: http://linux.die.net/man/1/pv

consider trying this with websockets: http://reactphp.org/ - look at the rachet project. this will give you realtime output of whatever you want to execute.