|
@@ -0,0 +1,28 @@
|
|
|
|
+<?php
|
|
|
|
+ function handleREST($server,$get) {
|
|
|
|
+ $url = (array_key_exists('PATH_INFO',$server) ? $server['PATH_INFO'] : '/');
|
|
|
|
+ $method = $server['REQUEST_METHOD'];
|
|
|
|
+ parse_str(file_get_contents('php://input'),$contentargs);
|
|
|
|
+ $arguments = array_merge($get,$contentargs);
|
|
|
|
+ $accept = array_key_exists('HTTP_ACCEPT',$server) ? $server['HTTP_ACCEPT'] : '*/*';
|
|
|
|
+ $ret = new StdClass;
|
|
|
|
+ $ret->url = $url;
|
|
|
|
+ $ret->method = $method;
|
|
|
|
+ $ret->arguments = $arguments;
|
|
|
|
+ $ret->accept = $accept;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return $ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $rest = handleREST($_SERVER,$_POST);
|
|
|
|
+
|
|
|
|
+ $num = rand(3,9);
|
|
|
|
+ $rest->number = $num;
|
|
|
|
+
|
|
|
|
+ header("content-type: application/json");
|
|
|
|
+ echo json_encode($rest);
|
|
|
|
+
|
|
|
|
+ exit;
|
|
|
|
+?>
|