include("header.php"); include("config.php"); if($_REQUEST['search']){ //SEARCH $search=str_replace(" ","+",$_REQUEST['search']); $search_url = "http://xoap.weather.com/search/search?where=$search"; $fp = fopen($search_url,"r"); while (!feof ($fp)) $xml .= fgets($fp, 4096); fclose ($fp); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parse_into_struct($parser,$xml,$values,$index); xml_parser_free($parser); $counter=0; if($index[loc]!=""){ foreach ($index[loc] as $loc){ $location_code[$counter] = $values[$index[loc][$counter]][attributes][id]; $location_name[$counter] = $values[$index[loc][$counter]][value]; $xml=""; $counter++; } } if(count($index[loc])==1){ ?> }elseif(count($index[loc])>1){ ?>
| |
Weather data provided by Weather.com Weather script created by Redtie |
echo"No forecast was found for "; echo"".str_replace("+"," ",$search).""; ?> |
Home | Forecast for:
echo"$city"; ?> |
Day | Forecast | Description | Precip. chance |
echo $values[$day][attributes][t] . ", " . $values[$day][attributes][dt]; ?> |
echo"Hi: ".$values[$index[hi][$counter]][value]."°" ?> echo"Lo: ".$values[$index[low][$counter]][value]."°"; ?> |
echo $values[$index[t][$day_wind]][value]; echo ", Sunrise: "; echo $values[$index[sunr][$counter]][value]; echo ", Sunset: "; echo $values[$index[suns][$counter]][value]; echo " Wind: "; echo $values[$index[t][$day_text]][value] . " " . $values[$index[s][$day_windspeed]][value] . " $unit_speed"; echo ", Humidity: "; echo $values[$index[hmid][$day_humidity]][value] . "%"; ?> | echo $values[$index[ppcp][$day_precip]][value] . "%"; ?> |
> Night | >
echo"Hi: ".$values[$index[hi][$counter]][value]."°" ?> echo"Lo: ".$values[$index[low][$counter]][value]."°"; ?> | >
echo $values[$index[t][$night_wind]][value]; echo ", Sunrise: "; echo $values[$index[sunr][$counter]][value]; echo ", Sunset: "; echo $values[$index[suns][$counter]][value]; echo " Wind: "; echo $values[$index[t][$night_text]][value] . " " . $values[$index[s][$night_windspeed]][value] . " $unit_speed"; echo ", Humidity: "; echo $values[$index[hmid][$night_humidity]][value] . "%"; ?> | > echo $values[$index[ppcp][$night_precip]][value] . "%"; ?> |
Weather data provided by Weather.com Weather script created by Redtie |
| |
Weather data provided by Weather.com Weather script created by Redtie |