Note that there are some explanatory texts on larger screens.

plurals
  1. POBurstable Output for Long running scripts
    primarykey
    data
    text
    <p>script</p> <pre><code>&lt;?php include('time.php'); //time script echo "First 100 users of SO&lt;br/&gt;"; for($i=0; $i&lt;100;$i++){ $contents=file_get_contents("https://stackoverflow.com/privileges/user/".$i); preg_match('!&lt;div class="summarycount al"&gt;(.+?)&lt;/div&gt;!', $contents, $matches); $rep = $matches[1]; echo "&lt;br/&gt;".$i.") ".$rep."&lt;br/&gt;"; include('timetaken.php'); //script which outputs time difference } ?&gt; </code></pre> <p>output</p> <pre><code>First 100 users of SO 0) 0 2.3584280014038 1) 14,436 4.469074010849 2) 875 10.651238918304 3) 2,431 12.991086959839 4) 8,611 15.451638936996 5) 14,988 17.535580873489 6) 0 19.686461925507 7) 0 21.796992063522 8) 218 23.931365013123 9) 2,569 26.419286966324 10) 101 28.540382862091 11) 232 30.755586862564 12) 0 32.960548877716 13) 33,898 35.163224935532 14) 0 37.280658006668 15) 6,388 39.425274848938 16) 143 41.541421890259 17) 14,366 43.655340909958 18) 0 45.771246910095 19) 99 47.882269859314 20) 4,204 49.993322849274 21) 0 52.108762979507 22) 1,517 54.221307039261 23) 411 56.345490932465 24) 103 58.892389059067 Fatal error: Maximum execution time of 60 seconds exceeded in C:\test.php on line 5 </code></pre> <p>Problems with this script: 1. The page loads after 60 seconds when it timesout</p> <p>I know I can add a </p> <pre><code>set_time_limit(500); </code></pre> <p>to the code and get the first 100 reputations, but that will result in a page load after say 120seconds.</p> <p>How can I get the result in short bursts, as the data is gathered using PHP or using any other language (python, java) or anything else. Before someone says it, I have read <a href="https://stackoverflow.com/questions/2212635/best-way-to-manage-long-running-php-script">Best way to manage long-running php script?</a>, which may be a possible duplicate , but does not answer my question. <strong><em>My question is not completing the entire job, but displaying the results as it is being done.</em></strong></p> <p>(Please deal with the tags for me)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload