urlToShortCode($_POST["url"]); printf('

Short URL: %2$s

',$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'], SHORTURL_PREFIX . $code); exit; } catch (Exception $e) { // log exception and then redirect to error page. // header("Location: /error"); header("Location: index.php"); exit; }