53 lines
1.1 KiB
PHP
Executable File
53 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
/**************************
|
|
* API Loader *
|
|
* 18-07-2017 *
|
|
***************************
|
|
* Designed & Developed by *
|
|
* xdrm-brackets *
|
|
***************************
|
|
* https://xdrm.io/ *
|
|
**************************/
|
|
|
|
namespace api\core;
|
|
|
|
use \error\core\Error;
|
|
use \error\core\Err;
|
|
use \http\core\HttpRequest;
|
|
use \api\core\Request;
|
|
|
|
|
|
class Loader{
|
|
|
|
|
|
/* (1) Build an API Request from the HTTP Request
|
|
*
|
|
* @uri<String> URI
|
|
*
|
|
* @return outName<outType> outDesc
|
|
*
|
|
---------------------------------------------------------*/
|
|
public static function remote($uri){
|
|
|
|
/* (1) Fetch HttpRequest correct data
|
|
---------------------------------------------------------*/
|
|
/* (1) Parse HttpRequest data because php doesn't parse it for non-POST HTTP method */
|
|
$httprequest = new HttpRequest();
|
|
|
|
/* (2) For later use -> replace default @_POST global */
|
|
$_POST = $httprequest->POST();
|
|
|
|
/* (3) Get @data from @_POST values */
|
|
$data = $_POST;
|
|
|
|
|
|
/* (2) Build request
|
|
---------------------------------------------------------*/
|
|
return new Request($uri, $data);
|
|
}
|
|
|
|
|
|
|
|
|
|
} |