protected function obtainCookies(array &$options, $base_uri = null)
    {
        $client = new Client();

        $loginOptions = [
            'debug' => isset($options['debug']) && $options['debug'] ? true : false,
            'allow_redirects' => false,
            'cookies' => $this->coockieJar
        ];

        if (!is_null($base_uri)) {
            $loginOptions['base_uri'] = $base_uri;
        }

        $method = 'GET';
        if ($this->config['method'] === 'POST') {
            $loginOptions['form_params'] = $this->config['fields'];
            $method                      = 'POST';
        } else if ($this->config['method'] === 'JSON') {
            $loginOptions['body']                    = json_encode($this->config['fields']);
            $loginOptions['headers']['Content-Type'] = 'application/json';
            $method                                  = 'POST';
        } else if ($this->config['method'] === 'GET') {
            $loginOptions['query'] = !is_array($this->config['fields']) ? (array) $this->config['fields']
                    : $this->config['fields'];
        }

        if (isset($options['auth-cookie']['onBeforeLogin'])) {
            $closer       = $options['auth-cookie']['onBeforeLogin'];
            $loginOptions = $closer($loginOptions);
            if (false === $loginOptions) {
                return;
            }
        }

        $client->request($method, $this->config['uri'], $loginOptions);

        $this->loginMade = true;
    }
protected function obtainCookies(array &$options, $base_uri = null)
    {
        $client = new Client();

        $loginOptions = [
            'debug' => isset($options['debug']) && $options['debug'] ? true : false,
            'allow_redirects' => false,
            'cookies' => $this->coockieJar
        ];

        if (!is_null($base_uri)) {
            $loginOptions['base_uri'] = $base_uri;
        }

        $method = 'GET';
        if ($this->config['method'] === 'POST') {
            $loginOptions['form_params'] = $this->config['fields'];
            $method                      = 'POST';
        } else if ($this->config['method'] === 'JSON') {
            $loginOptions['body']                    = json_encode($this->config['fields']);
            $loginOptions['headers']['Content-Type'] = 'application/json';
            $method                                  = 'POST';
        } else if ($this->config['method'] === 'GET') {
            $loginOptions['query'] = !is_array($this->config['fields']) ? (array) $this->config['fields']
                    : $this->config['fields'];
        }

        if (isset($options['auth-cookie']['onBeforeLogin'])) {
            $closer       = $options['auth-cookie']['onBeforeLogin'];
            $loginOptions = $closer($loginOptions);
            if (false === $loginOptions) {
                return;
            }
        }

        $client->request($method, $this->config['uri'], $loginOptions);

        $this->loginMade = true;
    }
protected function obtainCookies ( array & $ options , $ base_uri = null ) { $ client = new Client ( ) ; $ loginOptions = [ 'debug' => isset ( $ options [ 'debug' ] ) && $ options [ 'debug' ] ? true : false , 'allow_redirects' => false , 'cookies' => $ this -> coockieJar ] ; if ( ! is_null ( $ base_uri ) ) { $ loginOptions [ 'base_uri' ] = $ base_uri ; } $ method = 'GET' ; if ( $ this -> config [ 'method' ] === 'POST' ) { $ loginOptions [ 'form_params' ] = $ this -> config [ 'fields' ] ; $ method = 'POST' ; } else if ( $ this -> config [ 'method' ] === 'JSON' ) { $ loginOptions [ 'body' ] = json_encode ( $ this -> config [ 'fields' ] ) ; $ loginOptions [ 'headers' ] [ 'Content-Type' ] = 'application/json' ; $ method = 'POST' ; } else if ( $ this -> config [ 'method' ] === 'GET' ) { $ loginOptions [ 'query' ] = ! is_array ( $ this -> config [ 'fields' ] ) ? ( array ) $ this -> config [ 'fields' ] : $ this -> config [ 'fields' ] ; } if ( isset ( $ options [ 'auth-cookie' ] [ 'onBeforeLogin' ] ) ) { $ closer = $ options [ 'auth-cookie' ] [ 'onBeforeLogin' ] ; $ loginOptions = $ closer ( $ loginOptions ) ; if ( false === $ loginOptions ) { return ; } } $ client -> request ( $ method , $ this -> config [ 'uri' ] , $ loginOptions ) ; $ this -> loginMade = true ; }
Hydrates a cookie jar.
Do not invoke this function if you don't know what you're doing

@param string|UriInterface $base_uri Optional base URI
@return void it only changes the class variable
Hydrates a cookie jar . Do not invoke this function if you don t know what you re doing