private function _request(string $method, array $params = [], array $optional = [])
    {
        $url = $this->_parseUrl($method, $params + $optional);
        if ($url === false) {
            throw new InvalidRequestException('Could not parse URL!');
        }

        $req = Request::get($url);
        $req->strict_ssl = $this->_verifySsl;
        $req->max_redirects = $this->_maxRedirects;
        $req->setConnectionTimeout(5);

        try {
            $buffer = $req->send();
        } catch (ConnectionErrorException $e) {
            throw new InvalidRequestException($e->getMessage(), $e->getCode(), $e);
        }

        if (!empty($buffer)) {
            try {
                return $this->_finishResponse($this->_parseResponse($buffer), $method, $params + $optional);
            } catch (InvalidResponseException $e) {
                throw new InvalidRequestException($e->getMessage(), $e->getCode(), $e);
            }
        }

        throw new InvalidRequestException('Empty response!');
    }
private function _request(string $method, array $params = [], array $optional = [])
    {
        $url = $this->_parseUrl($method, $params + $optional);
        if ($url === false) {
            throw new InvalidRequestException('Could not parse URL!');
        }

        $req = Request::get($url);
        $req->strict_ssl = $this->_verifySsl;
        $req->max_redirects = $this->_maxRedirects;
        $req->setConnectionTimeout(5);

        try {
            $buffer = $req->send();
        } catch (ConnectionErrorException $e) {
            throw new InvalidRequestException($e->getMessage(), $e->getCode(), $e);
        }

        if (!empty($buffer)) {
            try {
                return $this->_finishResponse($this->_parseResponse($buffer), $method, $params + $optional);
            } catch (InvalidResponseException $e) {
                throw new InvalidRequestException($e->getMessage(), $e->getCode(), $e);
            }
        }

        throw new InvalidRequestException('Empty response!');
    }
private function _request ( string $ method , array $ params = [ ] , array $ optional = [ ] ) { $ url = $ this -> _parseUrl ( $ method , $ params + $ optional ) ; if ( $ url === false ) { throw new InvalidRequestException ( 'Could not parse URL!' ) ; } $ req = Request :: get ( $ url ) ; $ req -> strict_ssl = $ this -> _verifySsl ; $ req -> max_redirects = $ this -> _maxRedirects ; $ req -> setConnectionTimeout ( 5 ) ; try { $ buffer = $ req -> send ( ) ; } catch ( ConnectionErrorException $ e ) { throw new InvalidRequestException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } if ( ! empty ( $ buffer ) ) { try { return $ this -> _finishResponse ( $ this -> _parseResponse ( $ buffer ) , $ method , $ params + $ optional ) ; } catch ( InvalidResponseException $ e ) { throw new InvalidRequestException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } } throw new InvalidRequestException ( 'Empty response!' ) ; }
Make API request

@param string $method
@param array $params
@param array $optional
@return bool|object
@throws InvalidRequestException
Make API request