summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2021-07-07 14:46:40 +0100
committerDavid T. Sadler <davidtsadler@googlemail.com>2021-07-07 14:46:40 +0100
commit0a3a8ca0ba903aa12face3c4b7273d4da288172a (patch)
tree9d7e209844732e5a2579f3af4c71d81af3bf58cc /includes
parent576160b4d38d28fc5aa70fa5c03d38712dc8ac17 (diff)
Refactor existing API and implement reading or urls
Diffstat (limited to 'includes')
-rw-r--r--includes/functions.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/includes/functions.php b/includes/functions.php
new file mode 100644
index 0000000..b5208e6
--- /dev/null
+++ b/includes/functions.php
@@ -0,0 +1,14 @@
+<?php declare(strict_types=1);
+
+function respondAndExit(int $responseCode, string $header, array $headers = []): void
+{
+ header($header, false, $responseCode);
+
+ foreach ($headers as $header) {
+ header($header);
+ }
+
+ header('Content-type: text/plain; charset=UTF-8');
+
+ exit();
+}