$pathIndex) return trim(urldecode($pathSegments[$pathIndex])); if ($query_params!=null && array_key_exists($query_param,$query_params)) { return trim(urldecode($query_params[$query_param])); } return null; } function parseDateOrDateTime($value) { $date= DateTime::createFromFormat("!Y-m-d\TH:i:s.uP", $value); if ($date!=null) return $date; $date= DateTime::createFromFormat("!Y-m-d\TH:i:s", $value); if ($date!=null) return $date; $date= DateTime::createFromFormat("!Y-m-d", $value); if ($date!=null) return $date; if ($date==null) { echo $value." no parse"; } return $date; } $segments = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/')); $query_str = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY); parse_str($query_str, $query_params); $location=extractParam($segments,1, $query_params, "location"); $unitGroup=extractParam($segments,2, $query_params, "unitGroup"); if ($unitGroup!="us" && $unitGroup!="metric" ) $unitGroup=""; $startDate=extractParam($segments,3, $query_params, "fromdate"); $endDate=extractParam($segments,4, $query_params, "todate"); $location=trim($location); $encodedLocation=$location!=null?urlencode($location):null; if ($startDate==null) $startDate=""; if ($endDate==null) $endDate=""; ?> Historical weather data for any location | Visual Crossing

Weather History Dashboard

Top