public static function ServerRequest::fromGlobals in Auth0 Single Sign On 8.2
Return a ServerRequest populated with superglobals: $_GET $_POST $_COOKIE $_FILES $_SERVER
Return value
File
- vendor/
guzzlehttp/ psr7/ src/ ServerRequest.php, line 166
Class
- ServerRequest
- Server-side HTTP request
Namespace
GuzzleHttp\Psr7Code
public static function fromGlobals() {
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$headers = getallheaders();
$uri = self::getUriFromGlobals();
$body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
$serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
return $serverRequest
->withCookieParams($_COOKIE)
->withQueryParams($_GET)
->withParsedBody($_POST)
->withUploadedFiles(self::normalizeFiles($_FILES));
}