public function send()
    {
        if (empty($this->uri)) {
            throw new InvalidArgumentException('Invalid url for request.');
        }

        $customRequest = new Request();
        $customRequest->setHeaders($this->_headers);
        $this->httpClient->setRequest($customRequest);

        $this->httpClient->setMethod($this->method);
        $this->httpClient->setUri($this->uri);

        if ($this->method == Request::METHOD_GET) {
            if (!empty($this->params)) {
                $this->httpClient->setParameterGet($this->params);
            }
        }

        if ($this->method == Request::METHOD_POST) {
            if (!empty($this->params)) {
                $this->httpClient->setParameterPost($this->params);
            }
        }

        if ($this->postRawData !== null) {
            $this->httpClient->setRawBody($this->postRawData);
        }

        try {
            $this->response = $this->httpClient->send();
            if (!$this->response->isSuccess()) {
                throw new RuntimeException('Http request failure!');
            }
            $this->request = $this->httpClient->getRequest();

            return $this->response;

        } catch (HttpClientRuntimeException $exception) {
            throw new RuntimeException($exception->getMessage());
        } catch (HttpRuntimeException $exception) {
            throw new RuntimeException($exception->getMessage());
        }
    }
public function send()
    {
        if (empty($this->uri)) {
            throw new InvalidArgumentException('Invalid url for request.');
        }

        $customRequest = new Request();
        $customRequest->setHeaders($this->_headers);
        $this->httpClient->setRequest($customRequest);

        $this->httpClient->setMethod($this->method);
        $this->httpClient->setUri($this->uri);

        if ($this->method == Request::METHOD_GET) {
            if (!empty($this->params)) {
                $this->httpClient->setParameterGet($this->params);
            }
        }

        if ($this->method == Request::METHOD_POST) {
            if (!empty($this->params)) {
                $this->httpClient->setParameterPost($this->params);
            }
        }

        if ($this->postRawData !== null) {
            $this->httpClient->setRawBody($this->postRawData);
        }

        try {
            $this->response = $this->httpClient->send();
            if (!$this->response->isSuccess()) {
                throw new RuntimeException('Http request failure!');
            }
            $this->request = $this->httpClient->getRequest();

            return $this->response;

        } catch (HttpClientRuntimeException $exception) {
            throw new RuntimeException($exception->getMessage());
        } catch (HttpRuntimeException $exception) {
            throw new RuntimeException($exception->getMessage());
        }
    }
public function send ( ) { if ( empty ( $ this -> uri ) ) { throw new InvalidArgumentException ( 'Invalid url for request.' ) ; } $ customRequest = new Request ( ) ; $ customRequest -> setHeaders ( $ this -> _headers ) ; $ this -> httpClient -> setRequest ( $ customRequest ) ; $ this -> httpClient -> setMethod ( $ this -> method ) ; $ this -> httpClient -> setUri ( $ this -> uri ) ; if ( $ this -> method == Request :: METHOD_GET ) { if ( ! empty ( $ this -> params ) ) { $ this -> httpClient -> setParameterGet ( $ this -> params ) ; } } if ( $ this -> method == Request :: METHOD_POST ) { if ( ! empty ( $ this -> params ) ) { $ this -> httpClient -> setParameterPost ( $ this -> params ) ; } } if ( $ this -> postRawData !== null ) { $ this -> httpClient -> setRawBody ( $ this -> postRawData ) ; } try { $ this -> response = $ this -> httpClient -> send ( ) ; if ( ! $ this -> response -> isSuccess ( ) ) { throw new RuntimeException ( 'Http request failure!' ) ; } $ this -> request = $ this -> httpClient -> getRequest ( ) ; return $ this -> response ; } catch ( HttpClientRuntimeException $ exception ) { throw new RuntimeException ( $ exception -> getMessage ( ) ) ; } catch ( HttpRuntimeException $ exception ) { throw new RuntimeException ( $ exception -> getMessage ( ) ) ; } }
Send http request

@throws InvalidArgumentException
@throws RuntimeException
@return Response
Send http request