/conditions/q/UK/Brighton.json"); $parsed_json = json_decode($json_string); $location = $parsed_json->{'location'}->{'city'}; $temp_C = $parsed_json->{'current_observation'}->{'temp_c'}; $wind_m = $parsed_json->{'current_observation'}->{'wind_mph'}; $wind_d = $parsed_json->{'current_observation'}->{'wind_dir'}; $type = $parsed_json->{'current_observation'}->{'weather'}; $URL = $parsed_json->{'current_observation'}->{'icon_url'}; $icon = $parsed_json->{'current_observation'}->{'icon'}; //echo "Current temperature in ${location} is: ${temp_f}\n"; #$img = 'current.gif'; #$temp_C = preg_replace(".[0-9]", "", $temp_C); #$temp_C = str_replace('.*', '', $temp_C); #$savename = "${type}.gif" date_default_timezone_set('Europe/London'); $time = date('H'); if ($time >= 6 && $time <= 19) { file_put_contents("img/${icon}.svg" ,file_get_contents ("http://icons.wxug.com/i/c/v1/${icon}.svg")); } else { file_put_contents("img/nt_${icon}.svg" ,file_get_contents ("http://icons.wxug.com/i/c/v1/nt_${icon}.svg")); $icon = "nt_${icon}"; } ?> /forecast/q/UK/Brighton.json"); $parsed_json2 = json_decode($json_string2); $lowtemp = $parsed_json2->{'forecast'}->{'simpleforecast'}->{'forecastday'}[0]->{'low'}->{'celsius'}; $hightemp = $parsed_json2->{'forecast'}->{'simpleforecast'}->{'forecastday'}[0]->{'high'}->{'celsius'}; $pop = $parsed_json2->{'forecast'}->{'simpleforecast'}->{'forecastday'}[0]->{'pop'}; $test ="Showers in the evening, then partly cloudy overnight. Low 3C. Winds NNW at 15 to 30 km/h. Chance of rain 80%." ?>
"; ?> ${temp_C}°C \n"; } else if ($temp_C >= -8 && $temp_C <= 18) { echo " ${temp_C}°C \n"; } else if ($temp_C > 17) { echo " ${temp_C}°C \n"; } ?>
${pop}%";?>