docs/examples/Broker.php
protected function makeRequest(string $method, string $command, array $parameters = [])
    {
        $commandUrl = $this->generateCommandUrl($command);
        $headers = [
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '. $this->getSessionId(),
        ];
        switch ($method) {
            case 'POST':
                $body = ['form_params' => $parameters];
                break;
            case 'GET':
                $body = ['query' => $parameters];
                break;
            default:
                $body = [];
                break;
        }
        $client = new GuzzleHttp\Client;
        $response = $client->request($method, $commandUrl, $body + ['headers' => $headers]);
        return json_decode($response->getBody(), true);
    }
protected function makeRequest(string $method, string $command, array $parameters = [])
    {
        $commandUrl = $this->generateCommandUrl($command);
        $headers = [
            'Accept' => 'application/json',
            'Authorization' => 'Bearer '. $this->getSessionId(),
        ];
        switch ($method) {
            case 'POST':
                $body = ['form_params' => $parameters];
                break;
            case 'GET':
                $body = ['query' => $parameters];
                break;
            default:
                $body = [];
                break;
        }
        $client = new GuzzleHttp\Client;
        $response = $client->request($method, $commandUrl, $body + ['headers' => $headers]);
        return json_decode($response->getBody(), true);
    }
protected function makeRequest ( string $ method , string $ command , array $ parameters = [ ] ) { $ commandUrl = $ this -> generateCommandUrl ( $ command ) ; $ headers = [ 'Accept' => 'application/json' , 'Authorization' => 'Bearer ' . $ this -> getSessionId ( ) , ] ; switch ( $ method ) { case 'POST' : $ body = [ 'form_params' => $ parameters ] ; break ; case 'GET' : $ body = [ 'query' => $ parameters ] ; break ; default : $ body = [ ] ; break ; } $ client = new GuzzleHttp \ Client ; $ response = $ client -> request ( $ method , $ commandUrl , $ body + [ 'headers' => $ headers ] ) ; return json_decode ( $ response -> getBody ( ) , true ) ; }
Make request to SSO server.

@param string $method Request method 'post' or 'get'.
@param string $command Request command name.
@param array $parameters Parameters for URL query string if GET request and form parameters if it's POST request.

@return array
Make request to SSO server .