3 * Experimental version that return chunked http response.
5 * Pulling the values is no longer needed as the one request will output
6 * the updates every second.
8 require_once('config.php');
9 require_once("ampy.inc.php");
11 $speed=@(int)$_GET['speed'];
16 header("Content-Type: text/json");
17 header("Transfer-Encoding: chunked");
22 // Send chunk to browser
23 function echo_chunk($chunk)
25 // The chunk must fill the output buffer or php won't send it
26 //$chunk = str_pad($chunk, 4096);
28 printf("%x\r\n%s\r\n", strlen($chunk), $chunk);
34 ampy_flush_rrd_daemon();
36 echo_chunk(json_encode(ampy_get_info()));