Domanda

I am trying to implement 3d secure. I have a xml containing some data as required by 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>

Then how can I request to http://msgtest.bankserv.co.za/maps/txns.asp with above xml and get their response back ? I tried curl, Soap etc and got error. Please help me with some answers in detail.

I have tried the following codes. Please let me know if this code is not correct.

$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;

When I am running this code I am getting exceptions.

È stato utile?

Soluzione

For posting values we can make use of CURL in php. Here you can use :

$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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top