Browse Source

Upload files to ''

bscheibel 4 years ago
parent
commit
e0840da2a7
1 changed files with 28 additions and 0 deletions
  1. 28 0
      return_random.php

+ 28 - 0
return_random.php

@@ -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;
+?>