From 28a5d1b4ce14d503e80dc413c3c8a95dfe9b28da Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 21 Mar 2014 15:45:20 +0000 Subject: [PATCH] Add the rest library : read the wanted output format, and display it if it is available git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1229 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- rest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 rest.php diff --git a/rest.php b/rest.php new file mode 100644 index 0000000..daadc4b --- /dev/null +++ b/rest.php @@ -0,0 +1,28 @@ +codetext ($code); + header ($_SERVER["SERVER_PROTOCOL"]." $code $text"); + $type = reset ($this->allowedtypes); + if (isset ($_SERVER["HTTP_ACCEPT"])) + { + $type = $http->bestChoice ($_SERVER["HTTP_ACCEPT"], $this->allowedtypes, + $type); + } + + require_once ("domframework/output$type.php"); + $constr = "output$type"; + $method = "out"; + $obj = new $constr (); + $obj->$method ($message); + } +}