diff options
| -rw-r--r-- | index.php | 8 | 
1 files changed, 7 insertions, 1 deletions
| @@ -15,7 +15,13 @@ $timenow = time();  $json = file_get_contents("https://prodgojweatherstorage.blob.core.windows.net/data/jerseyForecast.json");  $arr_json = json_decode($json, true); -$curtemp = $arr_json['currentTemprature']; +// Try to OCR the current temperature from Jersey Met's usually-more-up-to-date image... +if (!exec('tesseract "https://sojpublicdata.blob.core.windows.net/jerseymet/Town/internet.Temperature1.png" stdout | grep -Eo "[-0-9]+\.[0-9]+°C"', $ocroutput, $ocrretval)) { +  $curtemp = $arr_json['currentTemprature']; +} else { +  // ...if not, use the JSON output +  $curtemp = $ocroutput[0]; +}  // Today | 
