summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/index.php b/index.php
index fc92d21..f3280ba 100644
--- a/index.php
+++ b/index.php
@@ -9,7 +9,8 @@
<?php
libxml_use_internal_errors(true);
-date_default_timezone_set("UTC");
+date_default_timezone_set("Europe/Jersey");
+$timenow = time();
$json = file_get_contents("https://prodgojweatherstorage.blob.core.windows.net/data/jerseyForecast.json");
$arr_json = json_decode($json, true);
@@ -25,6 +26,7 @@ $uv[0] = $arr_json['forecastDay']['0']['uvIndex'];
$morning[0] = $arr_json['forecastDay']['0']['morningDescripiton']; // Try to...
$afternoon[0] = $arr_json['forecastDay']['0']['afternoonDescripiton']; // ...find a...
$night[0] = $arr_json['forecastDay']['0']['nightDescripiton']; // ...day summary
+$sunset[0] = $arr_json['forecastDay']['0']['sunSet'];
$frost[0] = $arr_json['forecastDay']['0']['frost'];
$winddesc[0] = $arr_json['forecastDay']['0']['windDescription'];
@@ -40,8 +42,17 @@ $night[1] = $arr_json['forecastDay']['1']['nightDescripiton'];
$frost[1] = $arr_json['forecastDay']['1']['frost'];
$winddesc[1] = $arr_json['forecastDay']['1']['windDescription'];
+// Title summary
-echo "<title>Max $maxtemp[0], Min $mintemp[0], Cur $curtemp, UV $uv[0], Wind $wind[0], $morning[0] $afternoon[0] $night[0] $frost[0]</title>\n\n";
+if ($timenow >= strtotime($sunset[0])) {
+ $summary[0] = "$sunset[0]: $night[0]";
+} else if ($timenow >= strtotime("12:00:00")) {
+ $summary[0] = "12:00: $afternoon[0] $sunset[0]: $night[0]";
+} else {
+ $summary[0] = "00:00: $morning[0] 12:00: $afternoon[0] $sunset[0]: $night[0]";
+}
+
+echo "<title>Max $maxtemp[0], Min $mintemp[0], Cur $curtemp, UV $uv[0], Wind $wind[0], $summary[0] $frost[0]</title>\n\n";
echo "</head>\n\n";
echo "<body>\n\n";