<?php
$filename = "Temperature";
header("Content-type: application/vnd.ms-excel");
header( "Content-disposition: filename=".$filename.".csv");
print "location, weather, obs_time, latitude, longitude, temp_f, wind_d, wind_deg, wind_mph";
print"\r\n";
$xml = simplexml_load_file('http://w1.weather.gov/xml/current_obs/KCHA.xml');
$loca=$xml->location;
$weat=$xml->weather;
$obs_time=$xml->observation_time;
$lat=$xml->latitude;
$long=$xml->longitude;
$temp=$xml->temp_f;
$wind_d=$xml->wind_dir;
$wind_deg=$xml->wind_degrees;
$wind_m=$xml->wind_mph;
print "\"".$loca."\",";
print "\"".$weat."\",";
print "\"".$obs_time."\",";
print "\"".$lat."\",";
print "\"".$long."\",";
print "\"".$temp."\",";
print "\"".$wind_d."\",";
print "\"".$wind_deg."\",";
print "\"".$wind_m."\",";
print"\r\n";
?>
preferences:
48.25 ms | 402 KiB | 5 Q