From dca0bf78b5fb2f587ac295c686f52bbb74bb2bc3 Mon Sep 17 00:00:00 2001 From: zyphlar Date: Tue, 16 Jan 2018 20:38:53 -0800 Subject: [PATCH] Update time-temp.php --- time-temp.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/time-temp.php b/time-temp.php index f1be5ea..ea6c48d 100644 --- a/time-temp.php +++ b/time-temp.php @@ -5,6 +5,15 @@ require('time-temp.inc.php'); $cache_path = "/tmp/timetemp-".md5($url.$wunderkey.$feature.$path).".tmp"; $from_cache = 0; +// by default do voice +$voice = true; +$sms = false; + +if (array_key_exists('type', $_GET)) { + if ($_GET['type'] == "voice") { $voice = true; $sms = false; } + if ($_GET['type'] == "sms") { $voice = false; $sms = true; } +} + // update weather every half hour if (file_exists($cache_path) && (time() - filemtime($cache_path) < 1800) ) { $response = file_get_contents($cache_path); @@ -39,17 +48,24 @@ if ($obs->pressure_trend == "+") { header('Content-Type: application/xml'); -echo ' +$out = ' - - The current time is '.$date->format('g:i:s A').', on '.$date->format('F j, Y').'. It is week number '.((int)$date->format('W')).' and day number '.((int)$date->format('z')).' of the year. It '.$dst_text.' currently Daylight Saving Time in '.$date->format('T').'. The temperature in '.$obs->observation_location->city.' was '.$obs->temp_f.'F today at '.$obs_date->format('g:i A').' (zyphon.com via wunderground.com) - Hello. '.$date->format('g:i:s A').' is the current time, on '.$date->format('F j, Y').'. It is week number '.((int)$date->format('W')).' and day number '.((int)$date->format('z')).' of the year. It '.$dst_text.' currently Daylight Saving Time in '.$obs->display_location->city.'. +'; + +if ($voice) { + $out .= 'Hello. '.$date->format('g:i:s A').' is the current time, on '.$date->format('F j, Y').'. It is week number '.((int)$date->format('W')).' and day number '.((int)$date->format('z')).' of the year. It '.$dst_text.' currently Daylight Saving Time in '.$obs->display_location->city.'. Thank you for calling '.$obs->display_location->city.' Time and Temperature: a free hobby service, courtesy of zye fawn dot com, and Weather Underground dot com. The temperature in '.$obs->observation_location->city.' was '.$obs->temp_f.' degrees Fahrenheit today at '.$obs_date->format('g:i A').'. The weather was '.$obs->weather.' with winds '.$obs->wind_string.'. The dew point was '.$obs->dewpoint_f.' degrees, pressure '.$obs->pressure_mb.' millibars '.$pres_text.', visibility '.$obs->visibility_mi.' miles. The temperature felt like '.$obs->feelslike_f.' degrees. Please press any key to hear this message again. - Thanks again for calling. Goodbye. -'; + Thanks again for calling. Goodbye.'; +} +if ($sms) { + $out .= 'The current time is '.$date->format('g:i:s A').', on '.$date->format('F j, Y').'. It is week number '.((int)$date->format('W')).' and day number '.((int)$date->format('z')).' of the year. It '.$dst_text.' currently Daylight Saving Time in '.$date->format('T').'. The temperature in '.$obs->observation_location->city.' was '.$obs->temp_f.'F today at '.$obs_date->format('g:i A').' (zyphon.com via wunderground.com)'; +} +$out .= ''; + +echo $out;