I trying to setup the sagepay reporting api to query transactions.
I got some code from another question on here which almost gets me all the way, but what I want to do is save the XML returned and store it in a database. How would I do this?
<?php
$command = 'getTransactionList';
$vendor = 'vendor';
$user = 'user';
$password = 'password';
$startdate = '01/10/2015 00:00:01';
$enddate = '31/10/2015 23:59:59';
$string = '<command>'.$command.'</command><vendor>'.$vendor.'</vendor><user>'.$user.'</user><startdate>'.$startdate.'</startdate><enddate>'.$enddate.'</enddate>';
$crypt = MD5($string . '<password>' . $password . '</password>');
$curl = curl_init('https://test.sagepay.com/access/access.htm');
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curl);
$rxml = new SimpleXMLElement($result);
?>
<html>
<body>
<form method="post" action="https://test.sagepay.com/access/access.htm" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="XML" value="<vspaccess><?php echo $string; ?><signature><?php echo $crypt; ?></signature></vspaccess>" />
<input type="submit" name="Button" value="Send" />
</form>
</body>
</html>
Thanks for any help you can give.