Request 

\nn\t3::Request() 

Access to GET / POST variables, file containers etc.

Overview of Methods 

\nn\t3::Request()->DELETE($url = '', $queryParams = [], $headers = []); 

Sends a DELETE request (via curl) to a server

\nn\t3::Request()->DELETE( 'https://...', ['a'=>'123'] );
\nn\t3::Request()->DELETE( 'https://...', ['a'=>'123'], ['Accept-Encoding'=>'gzip, deflate'] );
Copied!
@param string $url
@param array $queryParams
@param array $headers
@return array

| ➜ Go to source code of Request::DELETE()

\nn\t3::Request()->GET($url = '', $queryParams = [], $headers = [], $dontNestArrays = false); 

Sends a GET request (via curl) to a server

\nn\t3::Request()->GET( 'https://...', ['a'=>'123'] );
\nn\t3::Request()->GET( 'https://...', ['a'=>'123'], ['Accept-Encoding'=>'gzip, deflate'] );

// if 'a'=>[1,2,3] should be sent as a=1&a=2&a=3 instead of a[]=1&a[]=2&a[]=3
 \nn\t3::Request()->GET( 'https://...', ['a'=>[1,2,3]], [], true );
Copied!
@param string $url
@param array $queryParams
@param array $headers
@return array

| ➜ Go to source code of Request::GET()

\nn\t3::Request()->GET_JSON($url = '', $queryParams = [], $headers = NULL); 

Sends a GET request to a server and parses the result as JSON

\nn\t3::Request()->GET_JSON( 'https://...', ['a'=>'123'] );
Copied!
@param string $url
@param array $queryParams
@param array $headers
@return array

| ➜ Go to source code of Request::GET_JSON()

\nn\t3::Request()->GP($varName = NULL); 

Merge from $_GET and $_POST variables

\nn\t3::Request()->GP();
Copied!

| @return array

| ➜ Go to source code of Request::GP()

\nn\t3::Request()->JSON($url = '', $data = [], $headers = NULL); 

Sends a JSON to a server via POST

\nn\t3::Request()->JSON( 'https://...', ['a'=>'123'] );
Copied!
@param string $url
@param array $data
@param array|null $headers
@return array

| ➜ Go to source code of Request::JSON()

\nn\t3::Request()->POST($url = '', $postData = [], $headers = [], $requestType = 'POST'); 

Sends a POST request (via CURL) to a server.

\nn\t3::Request()->POST( 'https://...', ['a'=>'123'] );
\nn\t3::Request()->POST( 'https://...', ['a'=>'123'], ['Accept-Encoding'=>'gzip, deflate'] );
Copied!
@param string $url
@param array $postData
@param array $headers
@return array

| ➜ Go to source code of Request::POST()

\nn\t3::Request()->PUT($url = '', $data = [], $headers = []); 

Sends a PUT request (via curl) to a server

\nn\t3::Request()->PUT( 'https://...', ['a'=>'123'] );
\nn\t3::Request()->PUT( 'https://...', ['a'=>'123'], ['Accept-Encoding'=>'gzip, deflate'] );
Copied!
@param string $url
@param array $data
@param array $headers
@return array

| ➜ Go to source code of Request::PUT()

\nn\t3::Request()->PUT_JSON($url = '', $data = [], $headers = []); 

Sends a PUT request (via curl) to a server as JSON

\nn\t3::Request()->PUT_JSON( 'https://...', ['a'=>'123'] );
\nn\t3::Request()->PUT_JSON( 'https://...', ['a'=>'123'], ['Accept-Encoding'=>'gzip, deflate'] );
Copied!
@param string $url
@param array $data
@param array $headers
@return array

| ➜ Go to source code of Request::PUT_JSON()

\nn\t3::Request()->files($path = NULL, $forceArray = false); 

Get and normalize file uploads from $_FILES.

Normalizes the following file upload variants. Removes empty file uploads from the array.

	
	
	
	
Copied!
Examples:
GetALL file info from $_FILES.
\nn\t3::Request()->files();
\nn\t3::Request()->files( true ); // Force array
Copied!

Get file info from tx_nnfesubmit_nnfesubmit[...].

\nn\t3::Request()->files('tx_nnfesubmit_nnfesubmit');
\nn\t3::Request()->files('tx_nnfesubmit_nnfesubmit', true); // Force array
Copied!

Only get files from tx_nnfesubmit_nnfesubmit[fal_media].

\nn\t3::Request()->files('tx_nnfesubmit_nnfesubmit.fal_media' );
\nn\t3::Request()->files('tx_nnfesubmit_nnfesubmit.fal_media', true ); // Force array
Copied!

| @return array

| ➜ Go to source code of Request::files()

\nn\t3::Request()->getAuthorizationHeader(); 

Read the Authorization header from the request.

\nn\t3::Request()->getAuthorizationHeader();
Copied!

Important: If this does not work, the following line is probably missing in the .htaccess is probably missing the following line:

# nnhelpers: Use when PHP is executed in PHP CGI mode
RewriteRule . - E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
Copied!

| @return string

| ➜ Go to source code of Request::getAuthorizationHeader()

\nn\t3::Request()->getBasicAuth(); 

Read the Basic Authorization Header from the request. If available, the username and password are returned.

$credentials = \nn\t3::Request()->getBasicAuth(); // ['username'=>'...', 'password'=>'...']
Copied!

Example call from a test script:

echo file_get_contents('https://username:password@www.testsite.com');
Copied!

| @return array

| ➜ Go to source code of Request::getBasicAuth()

\nn\t3::Request()->getBearerToken(); 

Read the bearer header Is used, among other things, to transmit a JWT (Json Web Token).

\nn\t3::Request()->getBearerToken();
Copied!

| @return string|null

| ➜ Go to source code of Request::getBearerToken()

\nn\t3::Request()->getJwt(); 

Read the JWT (Json Web Token) from the request, validate it and, if the signature is successfully check the signature and return the payload of the JWT.

\nn\t3::Request()->getJwt();
Copied!

| @return array|string

| ➜ Go to source code of Request::getJwt()

\nn\t3::Request()->getUri($varName = NULL); 

Return the request URI. Basically the URL / the GET string in the browser URL bar, which is stored in $_SERVER['REQUEST_URI'] is saved.

\nn\t3::Request()->getUri();
Copied!

| @return string

| ➜ Go to source code of Request::getUri()

\nn\t3::Request()->mergeGetParams($url = '', $getParams = [], $dontNestArrays = false); 

@param string $url
@param array $getParams
@param bool $dontNestArrays
@return string

| ➜ Go to source code of Request::mergeGetParams()

Methods