urlToShortCode($_POST["url"]); $http = isset($_SERVER['HTTPS'])?'https':'http'; printf('
Short URL: %2$s
',$http.'://'.$_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; }