Alex_isback Posted December 8, 2022 Share Posted December 8, 2022 Hello everyone I use Curl and php 7, is it possible while unloading data view only last result and delete the previous ones (ob_flush())? Quote Processing....images [Pagina#1/1 - Foto#2/7] Processing....images [Pagina#1/1 - Foto#3/7] Processing....images [Pagina#1/1 - Foto#4/7] Processing....images [Pagina#1/1 - Foto#5/7] Processing....images [Pagina#1/1 - Foto#6/7] Processing....images [Pagina#1/1 - Foto#7/7] example: Clear everyone except last Quote Processing....images [Pagina#1/1 - Foto#7/7] for ($i=0;$i<count($str[1]);$i++) { //echo "\rScaricamento in corso... [Pagina#". ($z+1)."/".$pages." - Foto#".(++$u)."/".$pagesnum[1]."]"; if (!file_exists($folder.'_'.$u.'_'.$images.'.jpg')) file_put_contents($folder.'_'.$u.'_'.$images.'.jpg', get('https://m.media-amazon.com/images/M/'.$str[1][$i].$str[2][$i].'jpg')); echo "[Pagina#".($z+1)."/".$pages." - Foto#".($u)."/".$pagesnum[1]."]" . ' <b style="color:red;">Processing....images</b> ' ; ob_flush(); # http://php.net/ob_flush flush(); # http://php.net/flush sleep(1); # http://php.net/sleep } Quote Link to comment https://forums.phpfreaks.com/topic/315625-ob_flush-php-delete-old-values-and-view-last/ Share on other sites More sharing options...
kicken Posted December 12, 2022 Share Posted December 12, 2022 You can't echo something, have it displayed, then remove it. Once the content has been sent to the browser for display it's there. Trying to stream content as a progress indicator is already questionable. It may or may not working depending on what kind of software / buffers are involved in the connection. If you want to progress indication then the ideal thing to do would be to run your tasks as background requests using fetch() and update a display with the progress information as they complete. 1 Quote Link to comment https://forums.phpfreaks.com/topic/315625-ob_flush-php-delete-old-values-and-view-last/#findComment-1603475 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.