-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathexample_show_json.php
More file actions
40 lines (37 loc) · 717 Bytes
/
example_show_json.php
File metadata and controls
40 lines (37 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<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>