"Fossies" - the Fresh Open Source Software Archive

Member "HTTPing-2.9/example_show_json.php" (29 Oct 2022, 717 Bytes) of package /linux/www/HTTPing-2.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "example_show_json.php" see the Fossies "Dox" file reference documentation.

    1 <HTML>
    2 <BODY>
    3 <TABLE BORDER='1'>
    4 <TR><TH>sequence</TH><TH>data</TH></TR>
    5 <?
    6     $handle = popen('./httping -c 3 www.google.com -F -M', 'r');
    7     $read = '';
    8     while($line = fgets($handle))
    9         $read .= ' '.$line;
   10     fclose($handle);
   11 
   12     $fields = json_decode($read);
   13 
   14     for($index=0; $index<count($fields); $index++)
   15     {
   16         ?><TR><?
   17         ?><TD><? print $index + 1; ?></TD><?
   18         ?><TD><? ?></TD><?
   19         ?></TR><?
   20 
   21         ?><TR><?
   22         ?><TD><? ?></TD><?
   23         ?><TD><?
   24             ?><TABLE><?
   25             ?><TR><TH>key</TH><TH>value</TH></TR><?
   26             foreach($fields[$index] as $key => $value)
   27             {
   28                 ?><TR><?
   29                 ?><TD><? print $key; ?></TD><?
   30                 ?><TD><? print $value; ?></TD><?
   31                 ?></TR><?
   32             }
   33             ?></TABLE><?
   34         ?></TD><?
   35         ?></TR><?
   36     }
   37 ?>
   38 </TABLE>
   39 </BODY>
   40 </HTML>