One of our vendors sends us response codes after submitting information to their database.
They send the response codes in xml format to a URL we specified (http://www.wecaref.com/retrieve_codes.php)
We have a sample of the xml structure but how do we get the values as they will be changing based on the outcome of the transactions?
xml structure is:-
<Message date="30/04/2010 17:21:26">
<Version>1.0</Version>
<OrderID>2010043017155067</OrderID>
<TransactionType>Purchase</TransactionType>
<PAN>4278XXXX4626</PAN>
</Message>
Kindly note that the values will be dynamic based on outcome of the transactions.
We have tried using SimpleXML but can only get this done with known values and passed as string.
We have tried the following but did not output any data.
//Get XML mesaage response
$xml_feed_url = 'http://www.wecaref/retrieve_codes.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xml_feed_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);
$Message = new SimpleXMLElement($xml);
$orderid = $Message->Message->OrderID;
echo "orderid is ".$orderid;
//End get XML Response
Please help.
A simple debug technique like var_dump will show you the above.
docs :- http://www.php.net/manual/en/function.simplexml-load-string.php