CVS: phpweather data_retrieval.php,1.20,1.21
Brought to you by:
iridium
From: Max H. <ir...@us...> - 2002-03-22 17:54:12
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv27556 Modified Files: data_retrieval.php Log Message: Typo? Was broken, now fixed. Index: data_retrieval.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/data_retrieval.php,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- data_retrieval.php 20 Mar 2002 19:26:50 -0000 1.20 +++ data_retrieval.php 22 Mar 2002 17:54:08 -0000 1.21 @@ -233,18 +233,19 @@ /* We use the @file notation here because it might fail. */ $file = @file('http://weather.noaa.gov/pub/data/' . "observations/metar/stations/$icao.TXT"); + } /* Here we test to see if we actually got a METAR. */ if (is_array($file)) { /* The first line in the file is the date */ - $date = trim(array_shift($lines)); + $date = trim(array_shift($file)); /* The remaining lines are the METAR itself. This will merge the * remaining lines into one line by removing new-lines: */ - $metar = ereg_replace("[\n\r ]+", ' ', trim(implode(' ', $lines))); + $metar = ereg_replace("[\n\r ]+", ' ', trim(implode(' ', $file))); $date = explode(':', strtr($date, '/ ', '::')); if ($date[2] > gmdate('j')) { @@ -299,6 +300,7 @@ } /* We update and return the METAR */ $this->metar = $metar; + return $metar; } |