public static function createFromGlobals() {
		$request = new static;
		$request->get->setAll($_GET);
		$request->post->setAll($_POST);
		$request->setFiles($_FILES);
		$request->header->setAll(static::getAllHeaders());
		$request->server->setAll($_SERVER);
		$request->cookie->setAll($_COOKIE);
		$request->body = file_get_contents('php://input');

		$server = trim($request->server['SERVER_NAME'], '/');
		if(isset($request->server['SERVER_PORT']) && $request->server['SERVER_PORT'] != '80')
			$server .= ':'.$request->server['SERVER_PORT'];
		if($request->server->has('ORIG_SCRIPT_NAME'))
			$root = dirname($request->server['ORIG_SCRIPT_NAME']);
		else
			$root = dirname($request->server['SCRIPT_NAME']);
		$root = trim($root, '/');

		if($request->header->has('X_ORIGINAL_URL'))
			$url = $request->header['X_ORIGINAL_URL'];
		if($request->header->has('X_REWRITE_URL'))
			$url = $request->header['X_REWRITE_URL'];
		elseif($request->server->has('IIS_WasUrlRewritten'))
			$url = $request->server['IIS_WasUrlRewritten'];
		elseif($request->server->has('REQUEST_URI'))
			$url = $request->server['REQUEST_URI'];
		elseif($request->server->has('ORIG_PATH_INFO'))
			$url = $request->server['ORIG_PATH_INFO'];
		else
			$url = '';
		$url = ltrim($url, '/');
		$parse = parse_url($url);
		if(isset($parse['path']))
			$url = $parse['path'];
		else
			$url = '';
		$root = trim($root, '/');
		$url = preg_replace('/^'.preg_quote($root, '/').'/', '', $url);

		$protocol = $request->server['REQUEST_SCHEME'].'://';

		$request->setURL($server, $root, $url, $protocol);

		return $request;
	}
public static function createFromGlobals() {
		$request = new static;
		$request->get->setAll($_GET);
		$request->post->setAll($_POST);
		$request->setFiles($_FILES);
		$request->header->setAll(static::getAllHeaders());
		$request->server->setAll($_SERVER);
		$request->cookie->setAll($_COOKIE);
		$request->body = file_get_contents('php://input');

		$server = trim($request->server['SERVER_NAME'], '/');
		if(isset($request->server['SERVER_PORT']) && $request->server['SERVER_PORT'] != '80')
			$server .= ':'.$request->server['SERVER_PORT'];
		if($request->server->has('ORIG_SCRIPT_NAME'))
			$root = dirname($request->server['ORIG_SCRIPT_NAME']);
		else
			$root = dirname($request->server['SCRIPT_NAME']);
		$root = trim($root, '/');

		if($request->header->has('X_ORIGINAL_URL'))
			$url = $request->header['X_ORIGINAL_URL'];
		if($request->header->has('X_REWRITE_URL'))
			$url = $request->header['X_REWRITE_URL'];
		elseif($request->server->has('IIS_WasUrlRewritten'))
			$url = $request->server['IIS_WasUrlRewritten'];
		elseif($request->server->has('REQUEST_URI'))
			$url = $request->server['REQUEST_URI'];
		elseif($request->server->has('ORIG_PATH_INFO'))
			$url = $request->server['ORIG_PATH_INFO'];
		else
			$url = '';
		$url = ltrim($url, '/');
		$parse = parse_url($url);
		if(isset($parse['path']))
			$url = $parse['path'];
		else
			$url = '';
		$root = trim($root, '/');
		$url = preg_replace('/^'.preg_quote($root, '/').'/', '', $url);

		$protocol = $request->server['REQUEST_SCHEME'].'://';

		$request->setURL($server, $root, $url, $protocol);

		return $request;
	}
public static function createFromGlobals ( ) { $ request = new static ; $ request -> get -> setAll ( $ _GET ) ; $ request -> post -> setAll ( $ _POST ) ; $ request -> setFiles ( $ _FILES ) ; $ request -> header -> setAll ( static :: getAllHeaders ( ) ) ; $ request -> server -> setAll ( $ _SERVER ) ; $ request -> cookie -> setAll ( $ _COOKIE ) ; $ request -> body = file_get_contents ( 'php://input' ) ; $ server = trim ( $ request -> server [ 'SERVER_NAME' ] , '/' ) ; if ( isset ( $ request -> server [ 'SERVER_PORT' ] ) && $ request -> server [ 'SERVER_PORT' ] != '80' ) $ server .= ':' . $ request -> server [ 'SERVER_PORT' ] ; if ( $ request -> server -> has ( 'ORIG_SCRIPT_NAME' ) ) $ root = dirname ( $ request -> server [ 'ORIG_SCRIPT_NAME' ] ) ; else $ root = dirname ( $ request -> server [ 'SCRIPT_NAME' ] ) ; $ root = trim ( $ root , '/' ) ; if ( $ request -> header -> has ( 'X_ORIGINAL_URL' ) ) $ url = $ request -> header [ 'X_ORIGINAL_URL' ] ; if ( $ request -> header -> has ( 'X_REWRITE_URL' ) ) $ url = $ request -> header [ 'X_REWRITE_URL' ] ; elseif ( $ request -> server -> has ( 'IIS_WasUrlRewritten' ) ) $ url = $ request -> server [ 'IIS_WasUrlRewritten' ] ; elseif ( $ request -> server -> has ( 'REQUEST_URI' ) ) $ url = $ request -> server [ 'REQUEST_URI' ] ; elseif ( $ request -> server -> has ( 'ORIG_PATH_INFO' ) ) $ url = $ request -> server [ 'ORIG_PATH_INFO' ] ; else $ url = '' ; $ url = ltrim ( $ url , '/' ) ; $ parse = parse_url ( $ url ) ; if ( isset ( $ parse [ 'path' ] ) ) $ url = $ parse [ 'path' ] ; else $ url = '' ; $ root = trim ( $ root , '/' ) ; $ url = preg_replace ( '/^' . preg_quote ( $ root , '/' ) . '/' , '' , $ url ) ; $ protocol = $ request -> server [ 'REQUEST_SCHEME' ] . '://' ; $ request -> setURL ( $ server , $ root , $ url , $ protocol ) ; return $ request ; }
Create a Request from the global inputs.
@return Request
Create a Request from the global inputs .