예제 #1
0
 public static function fromXml($xml)
 {
     if ($xml == "" || $xml == NULL) {
         return;
     }
     $dom = new \SimpleXMLElement($xml, LIBXML_NOERROR, false);
     if (count($dom) == 0) {
         return;
     }
     $response = IgfsUtils::parseResponseFields($dom);
     $terminal = NULL;
     if (isset($response) && count($response) > 0) {
         $terminal = new TerminalInfo();
         $terminal->tid = IgfsUtils::getValue($response, "tid");
         $terminal->description = IgfsUtils::getValue($response, "description");
         $terminal->payInstr = IgfsUtils::getValue($response, "payInstr");
         $terminal->payInstrDescription = IgfsUtils::getValue($response, "payInstrDescription");
         if (isset($response["imgURL"])) {
             $imgURL = array();
             foreach ($dom->children() as $item) {
                 if ($item->getName() == "imgURL") {
                     $imgURL[] = $item->__toString();
                 }
             }
             $terminal->imgURL = $imgURL;
         }
     }
     return $terminal;
 }
예제 #2
0
 protected function parseResponse($response)
 {
     $response = str_replace("<soap:", "<", $response);
     $response = str_replace("</soap:", "</", $response);
     $dom = new \SimpleXMLElement($response, LIBXML_NOERROR, false);
     if (count($dom) == 0) {
         return;
     }
     $tmp = str_replace("<Body>", "", $dom->Body->asXML());
     $tmp = str_replace("</Body>", "", $tmp);
     $dom = new \SimpleXMLElement($tmp, LIBXML_NOERROR, false);
     if (count($dom) == 0) {
         return;
     }
     $root = BaseIgfsCg::$RESPONSE;
     if (count($dom->{$root}) == 0) {
         return;
     }
     $fields = IgfsUtils::parseResponseFields($dom->{$root});
     if (isset($fields)) {
         $fields[BaseIgfsCg::$RESPONSE] = $response;
     }
     return $fields;
 }
예제 #3
0
 protected function parseResponseMap($response)
 {
     parent::parseResponseMap($response);
     $xml = $response[BaseIgfsCg::$RESPONSE];
     $xml = str_replace("<soap:", "<", $xml);
     $xml = str_replace("</soap:", "</", $xml);
     $dom = new \SimpleXMLElement($xml, LIBXML_NOERROR, false);
     if (count($dom) == 0) {
         return;
     }
     $tmp = str_replace("<Body>", "", $dom->Body->asXML());
     $tmp = str_replace("</Body>", "", $tmp);
     $dom = new \SimpleXMLElement($tmp, LIBXML_NOERROR, false);
     if (count($dom) == 0) {
         return;
     }
     $xml_response = IgfsUtils::parseResponseFields($dom->response);
     if (isset($xml_response["terminal"])) {
         $terminal = array();
         foreach ($dom->response->children() as $item) {
             if ($item->getName() == "terminal") {
                 $terminal[] = TerminalInfo::fromXml($item->asXML());
             }
         }
         $this->terminal = $terminal;
     }
 }