private static function parseRawHttpRequest(array &$data) {

    	if(false === isset($_SERVER['CONTENT_TYPE'])) {
    		$_SERVER['CONTENT_TYPE'] = '';
    	}

		$input = static :: getBody();

		preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches);

		if(0 === count($matches)) {

			$json = @json_decode($input, true);

			if(true === (json_last_error() == JSON_ERROR_NONE)) {

				$data = $json;
				return $json;
			}

			parse_str(urldecode($input), $data);
			return $data;
		}

		$boundary 	= $matches[1];
		$blocks 	= preg_split("/-+$boundary/", $input);

		array_pop($blocks);

		foreach($blocks as $id => $block) {

			if('' === $block) {
				continue;
			}

			if(false !== strpos($block, 'application/octet-stream')) {
			
				preg_match("/name=\"([^\"]*)\".*stream[\n|\r]+([^\n\r].*)?$/s", $block, $matches);
				$data['files'][$matches[1]] = $matches[2];
			}
			else {

				preg_match('/name=\"([^\"]*)\"[\n|\r]+([^\n\r].*)?\r$/s', $block, $matches);
				$data[$matches[1]] = $matches[2];
			}
		}
	}
private static function parseRawHttpRequest(array &$data) {

    	if(false === isset($_SERVER['CONTENT_TYPE'])) {
    		$_SERVER['CONTENT_TYPE'] = '';
    	}

		$input = static :: getBody();

		preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches);

		if(0 === count($matches)) {

			$json = @json_decode($input, true);

			if(true === (json_last_error() == JSON_ERROR_NONE)) {

				$data = $json;
				return $json;
			}

			parse_str(urldecode($input), $data);
			return $data;
		}

		$boundary 	= $matches[1];
		$blocks 	= preg_split("/-+$boundary/", $input);

		array_pop($blocks);

		foreach($blocks as $id => $block) {

			if('' === $block) {
				continue;
			}

			if(false !== strpos($block, 'application/octet-stream')) {
			
				preg_match("/name=\"([^\"]*)\".*stream[\n|\r]+([^\n\r].*)?$/s", $block, $matches);
				$data['files'][$matches[1]] = $matches[2];
			}
			else {

				preg_match('/name=\"([^\"]*)\"[\n|\r]+([^\n\r].*)?\r$/s', $block, $matches);
				$data[$matches[1]] = $matches[2];
			}
		}
	}
private static function parseRawHttpRequest ( array & $ data ) { if ( false === isset ( $ _SERVER [ 'CONTENT_TYPE' ] ) ) { $ _SERVER [ 'CONTENT_TYPE' ] = '' ; } $ input = static :: getBody ( ) ; preg_match ( '/boundary=(.*)$/' , $ _SERVER [ 'CONTENT_TYPE' ] , $ matches ) ; if ( 0 === count ( $ matches ) ) { $ json = @ json_decode ( $ input , true ) ; if ( true === ( json_last_error ( ) == JSON_ERROR_NONE ) ) { $ data = $ json ; return $ json ; } parse_str ( urldecode ( $ input ) , $ data ) ; return $ data ; } $ boundary = $ matches [ 1 ] ; $ blocks = preg_split ( "/-+$boundary/" , $ input ) ; array_pop ( $ blocks ) ; foreach ( $ blocks as $ id => $ block ) { if ( '' === $ block ) { continue ; } if ( false !== strpos ( $ block , 'application/octet-stream' ) ) { preg_match ( "/name=\"([^\"]*)\".*stream[\n|\r]+([^\n\r].*)?$/s" , $ block , $ matches ) ; $ data [ 'files' ] [ $ matches [ 1 ] ] = $ matches [ 2 ] ; } else { preg_match ( '/name=\"([^\"]*)\"[\n|\r]+([^\n\r].*)?\r$/s' , $ block , $ matches ) ; $ data [ $ matches [ 1 ] ] = $ matches [ 2 ] ; } } }
Parses raw HTTP request string
@param array $data
Parses raw HTTP request string