public static function returnRequest($requestedCathegory, $requestedSubCathegory) { $handler = new Retriever(); return $handler->handleRequest($requestedCathegory, $requestedSubCathegory); }
<?php session_start(); //require_once ('error_handler.php'); require_once 'clients_retrieve_rues_class.php'; $retriever = new Retriever($_POST['inputValue']); $response = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . '<response>' . ' <ville>' . $retriever->ville() . ' </ville>' . ' <commune>' . $retriever->commune() . ' </commune>' . ' <pays>' . $retriever->pays() . ' </pays>' . '</response>'; if (ob_get_length()) { ob_clean(); } header('Content-Type: text/xml'); echo $response;
$tmp['pressure'] = $result[$i]['pressure']; array_push($response['results'], $tmp); } } else { $response["error"] = true; $response['message'] = "Information can't get from server"; } //echoRespnse(200, $response); }); /** * Listing weather data * method GET * url /weather/daily */ $app->get('/weather/daily/:city', 'authenticate', function ($city) { $retriever = new Retriever(); // fetching all data $result = $retriever->getDailyWeather($city); if ($result != null) { $response["results"] = array(); for ($i = 0; $i < sizeof($result); $i++) { $tmp = array(); $tmp['time'] = $result[$i]['time']; $tmp['summary'] = $result[$i]['summary']; $tmp['icon'] = $result[$i]['icon']; $tmp['temperatureMin'] = $result[$i]['temperatureMin']; $tmp['temperatureMax'] = $result[$i]['temperatureMax']; //$tmp['temperature'] = $result[$i]['temperature']; $tmp['humidity'] = $result[$i]['humidity']; $tmp['pressure'] = $result[$i]['pressure']; array_push($response['results'], $tmp);