0

我正在尝试实现 3d 安全。我有一个 xml,其中包含 3d secure.Like 所需的一些数据:

<CardinalMPI>
<MsgType>cmpi_lookup</MsgType>
<Version>1.7</Version>
<ProcessorId>xxx</ProcessorId>
<MerchantId>xxxxxx</MerchantId>
<TransactionPwd>xxxxxxxxxxx</TransactionPwd>
<TransactionType>C</TransactionType>
<Amount>56999</Amount>
<CurrencyCode>xxxxx</CurrencyCode>
<OrderNumber>xxxx</OrderNumber>
<CardNumber>xxx</CardNumber>
<CardExpMonth>xxx</CardExpMonth>
<CardExpYear>xxx</CardExpYear>
</CardinalMPI>

那么如何使用上述 xml 请求http://msgtest.bankserv.co.za/maps/txns.asp 并获得他们的回复?我尝试了 curl、Soap 等,但出现了错误。请帮我详细解答一些问题。

我已经尝试了以下代码。如果此代码不正确,请告诉我。

$writer = new XMLWriter();
$writer->openMemory();

$writer->startElement("CardinalMPI");
$writer->writeElement("MsgType","cmpi_lookup");
$writer->writeElement("Version","1.7");
$writer->writeElement("ProcessorId","xxxxx");
$writer->writeElement("MerchantId","xxxxxxx");
$writer->writeElement("TransactionPwd","xxxxx");
$writer->writeElement("TransactionType","C");
$writer->writeElement("Amount",$xxxx);
$writer->writeElement("CurrencyCode","xxxx");
$writer->writeElement("OrderNumber","xxxxxxxxxx");
$writer->writeElement("CardNumber","'xxxxxxxxx");
$writer->writeElement("CardExpMonth","xx");
$writer->writeElement("CardExpYear","xxxx");
$writer->endElement();
$writer->endElement();
$writer->endDocument();
$request = $writer->outputMemory(true);

$serviceArguments =       array("validateRequest"=>"0","protocol"=>"v_xml","protocolVersion"=>"2.0","request"=> $request);
$client = new SoapClient("msgtest.bankserv.co.za/maps/txns.asp", array('local_cert'=> "certificate.pem"));
$result = $client->Execute($serviceArguments);
$xml=$result->ExecuteResult;

当我运行此代码时,我遇到了异常。

4

1 回答 1

0

对于发布值,我们可以在 php.ini 中使用 CURL。在这里您可以使用:

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, "your url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "yr_variable=".$your xml);
$result=curl_exec($ch);
curl_close($ch);
于 2013-07-16T20:36:04.787 回答