XML无效标签

时间:2013-10-02 20:13:45

标签: php xml opencart

我应该做些什么来防止自定义getaway的回调函数中的无效XML标记?

$h = fopen("banks/Mybank/log.txt", 'a');
        fwrite($h, 'ConfirmRequest: '.print_r($_REQUEST['ConfirmRequest'],true)."\n");  
        fclose($h);

输出是:

ConfirmRequest: <ConfirmRequest><TransactionId> Cool Attitude  #89</TransactionId><PaymentId>327600020200</PaymentId><PaymentDate>02.10.2013 23:41:26</PaymentDate><Amount>7000</Amount><CardType>VISA!472291******9871</CardType><Status>N</Status><Reason>Declined by merchant</Reason></ConfirmRequest>

结果在

上相同
$_REQUEST['ConfirmRequest'];

$this->resuest->request['ConfirmRequest'];

==========================

非常感谢gloomy.penguin!你能告诉我,我在这里做错了什么?

if(
        !openssl_verify(
                       'ConfirmRequest='.$ConfirmRequest,
                        base64_decode($signature),
                        openssl_get_publickey($cert)
                       )
            ) 
            die("signature error");




  $parser = xml_parser_create('');
        xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
            xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
        xml_parse_into_struct($parser, $ConfirmRequest, $vals);
        xml_parser_free($parser); 


            foreach ($vals as $data)
                  {
                   if ($data['tag']=='STATUS')
                   $Status=$data['value'];
                   if ($data['tag']=='PAYMENTID')
                   $PaymentId=$data['value'];
                   if ($data['tag']=='PAYMENTDATE')
                   $PaymentDate=$data['value'];
                   if ($data['tag']=='TRANSACTIONID')
                   $TransactionId=$data['value'];
                   if ($data['tag']=='AMOUNT')
                   $Amount=$data['value'];
                   if ($data['tag']=='REASON')
                   $Reason=$data['value'];
               if ($data['tag']=='CARDTYPE')
                   $CardType=$data['value'];

                  }


            $sta = fopen("banks/MyBank/status.txt", 'a');
            fwrite($sta, .print_r($data)."\n"); 
            fclose($sta);   

输出值为“1”......

1 个答案:

答案 0 :(得分:0)

这是您最初问题的答案:html_entity_decode()

由于您遇到与初始问题无关的新问题,我建议您关闭此问题(通过选择问题的答案)并针对您的新问题发布一个全新的帖子。包括您正在使用的代码以及变量中的内容,以便人们可以帮助您。