2 $RRDFILE="/home/nirgal/ampy/power.rrd";
4 header("Content-Type: text/json");
5 header("Transfer-Encoding: chunked");
9 // Send chunk to browser
10 function send_chunk($chunk)
12 // The chunk must fill the output buffer or php won't send it
13 $chunk = str_pad($chunk, 4096);
15 printf("%x\r\n%s\r\n", strlen($chunk), $chunk);
20 $info=rrd_lastupdate($RRDFILE);
23 'last_update' => 'unknown',
28 'last_update' => $info['last_update'],
29 'watts' => $info['data'][0]
31 send_chunk(json_encode($result));