/** * Send request to Rakuten Checkout * * @param string $xml * @return array|bool|string * @throws Exception */ public function sendRequest($xml, $type = 'default') { try { $this->_debugData['request_url'] = $this->_config->getRockinUrl($type); $this->_debugData['request'] = $xml; $httpAdapter = new Varien_Http_Adapter_Curl(); $httpAdapter->write(Zend_Http_Client::POST, $this->_config->getRockinUrl($type), '1.1', array(), $xml); $response = $httpAdapter->read(); } catch (Exception $e) { $this->_debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode()); $this->_debug($this->_debugData); throw $e; } $this->_debugData['response'] = $response; $response = preg_split('/^\\r?$/m', $response, 2); if (isset($response[1])) { $response = trim($response[1]); } else { $response = false; } $this->_debugData['response_processed'] = $response; $this->_debug($this->_debugData); return $response; }