<?php echo "Hello"; require "safest_route.php"; require_once "key.php"; require "clockwork/class-Clockwork.php"; function interpretClockwork($text) { $message = substr($text, 9); $arr = explode(" to ", $message); return array("start" => urlencode($arr[0]), "end" => urlencode($arr[1])); } $phone = $_GET["from"]; $locations = interpretClockwork($_GET["content"]); $clockwork = new Clockwork($clock_key); $route = getSafestRoute($locations["start"], $locations["end"], true, true)[0]; $message = "(1 / 2)"; foreach ($route["instructions"] as $instruction) { $message .= " " . strip_tags($instruction) . "\n"; } echo $message; var_dump($clockwork->send(array(array("to" => $phone, "message" => "(2 / 2) The rest of your journey and a map can be viewed at http://pedalplan.tk/results.php?start={$locations['start']}&end={$locations['end']}&congestion=on&safest=on."), array("to" => $phone, "message" => $message))));
if (isset($_GET[$getName])) { return $_GET[$getName]; } return $default; } function getStats($one, $two) { $safer = ceil(100 / $one * $two); $fatalities = ceil(($two - $one) / 3); return [$safer - 100, $fatalities]; } $start = urlencode(getVar("start")); $end = urlencode(getVar("end")); $safe = getVar("safest") == "on" ? true : false; $congestion = getVar("congestion") == "on" ? true : false; $routes = getSafestRoute($start, $end, $safe, $congestion); $stats = getStats($routes[0]["points"], $routes[$routes[0]["points"] == $routes[1]["points"] && count($routes) > 2 ? 2 : 1]["points"]); $safer = $stats[0]; $fatalities = $stats[1]; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link rel="shortcut icon" href="images/logo.png"> <script> var polylines = [<?php foreach ($routes[0]["polylines"] as $key => $polyline) {