/** * @param array $options * @return bool * @throws BpostApiBusinessException * @throws BpostApiResponseException * @throws BpostApiSystemException * @throws BpostCurlException * @throws BpostInvalidResponseException * @throws BpostInvalidXmlResponseException */ public function doCall(array $options) { $curl = curl_init(); // set options curl_setopt_array($curl, $options); $this->logger->debug('curl request', $options); // execute $this->responseBody = curl_exec($curl); $errorNumber = curl_errno($curl); $errorMessage = curl_error($curl); $headers = curl_getinfo($curl); $this->logger->debug('curl response', array('status' => $errorNumber . ' (' . $errorMessage . ')', 'headers' => $headers, 'response' => $this->responseBody)); // error? if ($errorNumber != '') { throw new BpostCurlException($errorMessage, $errorNumber); } if (isset($headers['http_code'])) { $this->responseHttpCode = $headers['http_code']; } if (isset($headers['Content-Type'])) { $this->responseContentType = $headers['Content-Type']; } return true; }