CVS: phpweather test2.php,NONE,1.1
Brought to you by:
iridium
From: Etienne T. <eti...@us...> - 2003-09-08 04:25:57
|
Update of /cvsroot/phpweather/phpweather In directory sc8-pr-cvs1:/tmp/cvs-serv25533 Added Files: test2.php Log Message: Added test2.php to test the retrieval and decoding of METAR and TAF reports --- NEW FILE --- <?php /* Call with a icao parameter i.e. test2.php?icao=KSFO */ error_reporting(E_ALL); /* We need the GET variables: */ extract($HTTP_GET_VARS); /* Load PHP Weather */ require('phpweather.php'); if (empty($language)) $language = 'en'; $weather = new phpweather(); if (!empty($icao)) { /* require(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php"); require(PHPWEATHER_BASE_DIR . "/output/pw_images.php"); $type = 'pw_text_' . $language; $text = new $type($weather); echo "<blockquote>\n" . $text->print_pretty() . "</blockquote>\n"; $icons = new pw_images($weather); echo '<p><img src="'.$icons->get_sky_image().'" /> '; echo '<img src="'.$icons->get_winddir_image().'" /> '; echo '<img src="'.$icons->get_temp_image().'" /></p>'; */ /* if (is_array($icao)) { foreach ($icao as $i) { $weather->set_icao($i); echo "METAR for $i : ".$weather->get_metar()."<br>\n"; echo "<br>"; } } else { */ $weather->set_icao($icao); echo "METAR for $icao : ".$weather->get_metar()."<br>\n"; echo "<br>Decoded METAR:<pre>"; print_r( $weather->decode_metar() ); echo "</pre><br>\n"; echo "TAF for $icao : ".$weather->get_taf()."<br>\n"; echo "<br>Decoded TAF:<pre>"; print_r( $weather->decode_taf() ); echo "</pre><br>\n"; /* } */ } ?> </body> </html> |