From f992150313a63d30aeda6e5f3dcd64fc62a06adb Mon Sep 17 00:00:00 2001 From: rvelices Date: Sat, 6 Jan 2007 11:13:08 +0000 Subject: Web service first version. git-svn-id: http://piwigo.org/svn/trunk@1698 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/ws_protocols/rest_handler.php | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 include/ws_protocols/rest_handler.php (limited to 'include/ws_protocols/rest_handler.php') diff --git a/include/ws_protocols/rest_handler.php b/include/ws_protocols/rest_handler.php new file mode 100644 index 000000000..184fc205a --- /dev/null +++ b/include/ws_protocols/rest_handler.php @@ -0,0 +1,60 @@ +isPost() ? $_POST : $_GET; + foreach ($param_array as $name => $value) + { + if ($name=='format') + continue; + if ($name=='method') + { + $method = $value; + } + else + { + $params[$name]=$value; + } + } + + if ( empty($method) ) + { + $service->sendResponse( + new PwgError(400, 'Missing "method" name') + ); + return; + } + $resp = $service->invoke($method, $params); + $service->sendResponse($resp); + } +} + +?> -- cgit v1.2.3