function getLongitude() { if (!isset($_POST['longitude'])) { exitWithHttpError(400, 'Missing longitude'); } $longitude = trim($_POST['longitude']); return $longitude; }
function getString($name, $maxLength, $allowNewlines = false) { if (!isset($_POST[$name])) { exitWithHttpError(400, "Missing {$name}"); } $string = trim($_POST[$name]); if (!isValidUtf8String($string, $maxLength, $allowNewlines)) { exitWithHttpError(400, "Invalid {$name}"); } return $string; }