[Mapbender-commits] r6745 - branches/banjo_dev/mapbender/http/rest

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Aug 10 12:26:28 EDT 2010


Author: banjo
Date: 2010-08-10 16:26:28 +0000 (Tue, 10 Aug 2010)
New Revision: 6745

Added:
   branches/banjo_dev/mapbender/http/rest/rest_response.php
Log:
Adding rest_respose.php file


Added: branches/banjo_dev/mapbender/http/rest/rest_response.php
===================================================================
--- branches/banjo_dev/mapbender/http/rest/rest_response.php	                        (rev 0)
+++ branches/banjo_dev/mapbender/http/rest/rest_response.php	2010-08-10 16:26:28 UTC (rev 6745)
@@ -0,0 +1,30 @@
+<?php
+
+send_rest_response($status = 500, $body = '', $content_type = 'text/html') {
+  $ini_file = "http_status.ini";
+  $status_codes = parse_ini_file($file);
+  $status_header = 'HTTP/1.1 '.$status.' '.$status_codes[$status];
+  header($status_header);
+  header('Content-type: '.$content_type);
+
+  if($body != '')
+  {
+    echo $body;
+    exit;
+  }
+  else
+  {
+    $body = '<html>
+      <head>
+      <meta http-equiv="Content-Type" content="text/html">
+      <title>' . $status . ' '. $status_codes[$status]. '</title>
+      </head>
+      <body>
+      <h1>'. $status_codes[$status].'</h1>
+      </body>
+      </html>';
+    echo $body;
+    exit;
+  }
+}
+?>



More information about the Mapbender_commits mailing list