Jump to content

print while script is going


Imaulle

Recommended Posts

hihi,

 

so I have the following, except it goes all the way up to server 400. Is there a way to make it print after each echo? As it is right now it will not print the entire list until all 400 servers are done

 

echo "Server 01: " . count($server01->listaccts()) . " / 130" . "<br />" ;
echo "Server 02: " . count($server02->listaccts()) . " / 130" . "<br />" ;
echo "Server 03: " . count($server03->listaccts()) . " / 130" . "<br />" ;
echo "Server 04: " . count($server04->listaccts()) . " / 130" . "<br />" ;
echo "Server 05: " . count($server05->listaccts()) . " / 130" . "<br />" ;
echo "Server 06: " . count($server06->listaccts()) . " / 130" . "<br />" ;
echo "Server 07: " . count($server07->listaccts()) . " / 130" . "<br />" ;
echo "Server 08: " . count($server08->listaccts()) . " / 130" . "<br />" ;

 

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/221927-print-while-script-is-going/
Share on other sites

soooo...

 

I would need to do something like this:

 

I tried this I think and it did not work :s

 

echo "Server 01: " . count($server01->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 02: " . count($server02->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 03: " . count($server03->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 04: " . count($server04->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 05: " . count($server05->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 06: " . count($server06->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 07: " . count($server07->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();
echo "Server 08: " . count($server08->listaccts()) . " / 130" . "<br />" ;
ob_flush();
flush();

 

 

Browsers and web servers operate on a request/response basis. They don't operate like a local application would. There are a number of reasons why a web server, php, the browser, and even proxy servers that might be between the two won't allow this to work. Once you get it working on one system it probably wont work on another.

 

You should either write this as a local compiled application using C or a similar programming language or if you must use a browser/web server you should use AJAX to periodically make http requests to the web server to get and display any updated information.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.