Package list httping / e926c20f-6cea-4170-8e27-19b33a22970a/main example_show_json.php
e926c20f-6cea-4170-8e27-19b33a22970a/main

Tree @e926c20f-6cea-4170-8e27-19b33a22970a/main (Download .tar.gz)

example_show_json.php @e926c20f-6cea-4170-8e27-19b33a22970a/mainraw · 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>