public function send_request($url, $method, $body, $headers, $timeOut, $request)
    {
        $headers["Authorization"] = "Basic " . base64_encode("$this->authId:$this->authToken");
        $request->setHeaders($headers);

        $options = [
            'http_errors' => false,
            'headers' => $headers,
            'body' => $body,
            'timeout' => $timeOut,
            'connect_timeout' => 60
        ];

        try {
            $rawResponse = $this->guzzleClient->request($method, $url, $options);
        } catch (RequestException $e) {
            throw new PlivoRequestException($e->getMessage());
        }

        $rawHeaders = $rawResponse->getHeaders();
        $rawBody = $rawResponse->getBody()->getContents();
        $httpStatusCode = $rawResponse->getStatusCode();

        return new PlivoResponse($request, $httpStatusCode, $rawBody, $rawHeaders);
    }
public function send_request($url, $method, $body, $headers, $timeOut, $request)
    {
        $headers["Authorization"] = "Basic " . base64_encode("$this->authId:$this->authToken");
        $request->setHeaders($headers);

        $options = [
            'http_errors' => false,
            'headers' => $headers,
            'body' => $body,
            'timeout' => $timeOut,
            'connect_timeout' => 60
        ];

        try {
            $rawResponse = $this->guzzleClient->request($method, $url, $options);
        } catch (RequestException $e) {
            throw new PlivoRequestException($e->getMessage());
        }

        $rawHeaders = $rawResponse->getHeaders();
        $rawBody = $rawResponse->getBody()->getContents();
        $httpStatusCode = $rawResponse->getStatusCode();

        return new PlivoResponse($request, $httpStatusCode, $rawBody, $rawHeaders);
    }
public function send_request ( $ url , $ method , $ body , $ headers , $ timeOut , $ request ) { $ headers [ "Authorization" ] = "Basic " . base64_encode ( "$this->authId:$this->authToken" ) ; $ request -> setHeaders ( $ headers ) ; $ options = [ 'http_errors' => false , 'headers' => $ headers , 'body' => $ body , 'timeout' => $ timeOut , 'connect_timeout' => 60 ] ; try { $ rawResponse = $ this -> guzzleClient -> request ( $ method , $ url , $ options ) ; } catch ( RequestException $ e ) { throw new PlivoRequestException ( $ e -> getMessage ( ) ) ; } $ rawHeaders = $ rawResponse -> getHeaders ( ) ; $ rawBody = $ rawResponse -> getBody ( ) -> getContents ( ) ; $ httpStatusCode = $ rawResponse -> getStatusCode ( ) ; return new PlivoResponse ( $ request , $ httpStatusCode , $ rawBody , $ rawHeaders ) ; }
Actually sends the request to the http client
@param string $url The URL to send the request to
@param string $method The request method used
@param string $body The request body containing POST data
@param array $headers The request headers
@param int $timeOut Timeout
@param PlivoRequest|null $request The original PlivoRequest object
@return PlivoResponse
@throws PlivoRequestException
Actually sends the request to the http client