From 75824b259d52fc6105f7fbad335f8837fdcbbd51 Mon Sep 17 00:00:00 2001 From: Stephen Jianu Date: Sun, 23 Mar 2025 16:52:03 -0500 Subject: [PATCH] Add daily wind speed, precipitation probability, and precipitation sum --- index.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index de0a177..49bdca1 100644 --- a/index.php +++ b/index.php @@ -7,7 +7,7 @@ echo "\n"; echo "

The current conditions in Park Ridge are:

\n"; echo "

\n"; - $url = "https://api.open-meteo.com/v1/forecast?latitude=42.0111&longitude=-87.8406&daily=temperature_2m_max,temperature_2m_min,weather_code¤t=temperature_2m,weather_code,is_day&timezone=America%2FChicago&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch"; + $url = "https://api.open-meteo.com/v1/forecast?latitude=42.0111&longitude=-87.8406&daily=temperature_2m_max,temperature_2m_min,weather_code,wind_speed_10m_max,precipitation_probability_max,precipitation_sum¤t=temperature_2m,weather_code,is_day,&timezone=America%2FChicago&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch"; $json = json_decode(file_get_contents($url), true); $jsonDescriptions = json_decode(file_get_contents("descriptions.json"), true); $code = $json["current"]["weather_code"]; @@ -23,7 +23,10 @@ $image = $jsonDescriptions[$code]["day"]["image"]; $tempHigh = floor($json["daily"]["temperature_2m_max"][$i]); $tempLow = floor($json["daily"]["temperature_2m_min"][$i]); - echo "
\n"; + $windSpeed = $json["daily"]["wind_speed_10m_max"][$i]; + $precipProb = $json["daily"]["precipitation_probability_max"][$i]; + $precipSum = $json["daily"]["precipitation_sum"][$i]; + echo "
\n"; echo "

\n"; echo "".date('l', strtotime($json["daily"]["time"][$i]))."
\n"; echo "

\n"; @@ -31,6 +34,10 @@ echo "High: ".$tempHigh."° F\n"; echo "
\n"; echo "Low: ".$tempLow."° F\n"; + echo "
\n"; + echo "Wind: ".$windSpeed." mph\n"; + echo "
\n"; + echo "Precip: ".$precipProb."%, ".$precipSum." in\n"; echo "
\n"; } echo "

\n"; -- 2.39.5