/** * @param RequestAbstract $request * @param string $endpointUrl * @return \Guzzle\Http\EntityBodyInterface|string * @throws Exception\ConnectionError */ private function sendRequest(RequestAbstract $request, $endpointUrl) { $client = new HttpClient(); $client->setConfig(array('curl.options' => array(CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false))); $httpRequest = $client->post($endpointUrl, null, $request->getRawData()); try { return $httpRequest->send()->getBody(); } catch (RequestException $e) { throw new ConnectionError($e->getMessage()); } }