Example #1
0
 /**
  * send this message and get response
  * save all warnings - errors are only saved if no payment-url is send from pnag
  *
  * @return SofortLibTransactionData $this
  */
 public function sendRequest()
 {
     $requestData[$this->_xmlRootTag] = $this->_parameters;
     $requestData = $this->_prepareRootTag($requestData);
     $xmlRequest = ArrayToXml::render($requestData);
     $this->_log($xmlRequest, ' XmlRequest -> ');
     $xmlResponse = $this->_sendMessage($xmlRequest);
     try {
         $this->_response = XmlToArray::render($xmlResponse);
     } catch (Exception $e) {
         $this->_response = array('errors' => array('error' => array('code' => array('@data' => '0999'), 'message' => array('@data' => $e->getMessage()))));
     }
     $this->_log($xmlResponse, ' XmlResponse <- ');
     $this->_handleErrors();
     $this->_parseXml();
     return $this;
 }
Example #2
0
 /**
  * Static entry point
  * @param string $input
  * @param bool $simpleStructure
  * @param int $maxDepth only parse XML to the provided depth
  * @return array
  * @throws XmlToArrayException
  */
 public static function render($input, $simpleStructure = false, $maxDepth = 20)
 {
     $Instance = new XmlToArray($input, $maxDepth);
     return $Instance->toArray($simpleStructure);
 }