src/FortniteClient.php
public static function sendUnrealClientPostRequest($endpoint, $params = null, $authorization = self::EPIC_LAUNCHER_AUTHORIZATION, $oauth = false) {
        $client = new Client(['http_errors' => false]);

        try {
            $response = $client->post($endpoint, [
                'form_params' => $params,
                'headers' => [
                    'User-Agent' => self::UNREAL_CLIENT_USER_AGENT,
                    'Authorization' => (!$oauth) ? 'basic ' . $authorization : 'bearer ' . $authorization,
                    'X-Epic-Device-ID' => self::generateDeviceId()
                ]
            ]);

            return json_decode($response->getBody()->getContents());
        } catch (GuzzleException $e) {
            throw $e; //Throw exception back up to caller
        }
    }
public static function sendUnrealClientPostRequest($endpoint, $params = null, $authorization = self::EPIC_LAUNCHER_AUTHORIZATION, $oauth = false) {
        $client = new Client(['http_errors' => false]);

        try {
            $response = $client->post($endpoint, [
                'form_params' => $params,
                'headers' => [
                    'User-Agent' => self::UNREAL_CLIENT_USER_AGENT,
                    'Authorization' => (!$oauth) ? 'basic ' . $authorization : 'bearer ' . $authorization,
                    'X-Epic-Device-ID' => self::generateDeviceId()
                ]
            ]);

            return json_decode($response->getBody()->getContents());
        } catch (GuzzleException $e) {
            throw $e; //Throw exception back up to caller
        }
    }
public static function sendUnrealClientPostRequest ( $ endpoint , $ params = null , $ authorization = self :: EPIC_LAUNCHER_AUTHORIZATION , $ oauth = false ) { $ client = new Client ( [ 'http_errors' => false ] ) ; try { $ response = $ client -> post ( $ endpoint , [ 'form_params' => $ params , 'headers' => [ 'User-Agent' => self :: UNREAL_CLIENT_USER_AGENT , 'Authorization' => ( ! $ oauth ) ? 'basic ' . $ authorization : 'bearer ' . $ authorization , 'X-Epic-Device-ID' => self :: generateDeviceId ( ) ] ] ) ; return json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; } catch ( GuzzleException $ e ) { throw $ e ; //Throw exception back up to caller } }
Sends a POST request as the Unreal Engine Client.
@param  string  $endpoint      API Endpoint to request
@param  array   $params        Request parameters, using the name as the array key and value as the array value
@param  string  $authorization Authorization header
@param  boolean $oauth         Is $authorization an OAuth2 token
@return object                 Decoded JSON response body
Sends a POST request as the Unreal Engine Client .