How to show PHP curl progress with AJAX How to show PHP curl progress with AJAX curl curl

How to show PHP curl progress with AJAX


You can store progress status in user`s session and then use ajax to get information from session then show it on page


You could check the status on the server using AJAX and let it call every amount of time. But that will spam your server unnecessary, it takes every time a new HTTP request. I'll advise you using a web socket. Than you build an connection directly between server and browser so you server could send directly an update of the progress when it happened to the browser.


Yes, as Moshen says :

You can store progress status in user`s session and then use ajax to get information from session then show it on page

but don't forget to call 'session_write_close()'

$nPourcent = round(($total_bytes_up_so_far / $total_bytes_up_expected)*100);session_start();$_SESSION['progress'] = $nPourcent;session_write_close();