Codebase list httping / upstream/2.5+git20200730.1.fa72809 example_show_json.php
upstream/2.5+git20200730.1.fa72809

Tree @upstream/2.5+git20200730.1.fa72809 (Download .tar.gz)

example_show_json.php @upstream/2.5+git20200730.1.fa72809raw · history · blame

<HTML>
<BODY>
<TABLE BORDER='1'>
<TR><TH>sequence</TH><TH>data</TH></TR>
<?
	$handle = popen('./httping -c 3 www.google.com -F -M', 'r');
	$read = '';
	while($line = fgets($handle))
		$read .= ' '.$line;
	fclose($handle);

	$fields = json_decode($read);

	for($index=0; $index<count($fields); $index++)
	{
		?><TR><?
		?><TD><? print $index + 1; ?></TD><?
		?><TD><? ?></TD><?
		?></TR><?

		?><TR><?
		?><TD><? ?></TD><?
		?><TD><?
			?><TABLE><?
			?><TR><TH>key</TH><TH>value</TH></TR><?
			foreach($fields[$index] as $key => $value)
			{
				?><TR><?
				?><TD><? print $key; ?></TD><?
				?><TD><? print $value; ?></TD><?
				?></TR><?
			}
			?></TABLE><?
		?></TD><?
		?></TR><?
	}
?>
</TABLE>
</BODY>
</HTML>