Forum Moderators: coopster
I am trying to convert a text file [weather.noaa.gov...] into the welcome page of my website (which is currently .htm). I'd like to strip the date/time line off and just leave the second line on, and then alter the font to be the same as my site.
Does anyone know how I can do this?
Thanks in advance!
[edited by: jatar_k at 5:18 pm (utc) on April 27, 2004]
[edit reason] linked up url [/edit]
i'm sure there is a better solution, but this works so far:
<?
$fp = fopen('http://weather.noaa.gov/pub/data/observations/metar/stations/EGGW.TXT', 'r');
while(!feof($fp)) {
$sContent .= fgets($fp, 4096);
}
fclose($fp);
$aLines = explode("\n", $sContent);
echo '<font face="verdana">' . $aLines[1] . '</font>';
?>
$lines = file [php.net]('http://weather.noaa.gov/pub/data/observations/metar/stations/EGGW.TXT');
print $lines[1];
$newString=substr($oldString,5);
Hope that helps.
Thanks for your help on this, I'm very new to PHP but am slowly coming to terms with its power!
$dataArray=file('http://weather.noaa.gov/pub/data/forecasts/shorttaf/stations/EGGW.TXT');
$lineToShow=implode(' ',array_slice [php.net]($dataArray,1));
which gives you all the lines in the array apart from the first one and join the lines together with a space.