Php 从xml文件读取(Sage Pay Reporting API)
我猜这个问题并不是一个专门针对Sage Pay的问题,虽然它是在我的问题中提到的,所以希望你能帮助我解决这个棘手的问题 以下是我想做的:Php 从xml文件读取(Sage Pay Reporting API),php,curl,simplexml,opayo,Php,Curl,Simplexml,Opayo,我猜这个问题并不是一个专门针对Sage Pay的问题,虽然它是在我的问题中提到的,所以希望你能帮助我解决这个棘手的问题 以下是我想做的: 主要任务是从Sage Pay Reporting API中检索数据—工作起来很有魅力 从xml输出文件读取并收集变量-不起作用 下面的代码确实显示了将我重定向到Sage Pay网站后的交易列表,但我就是不知道如何获取单笔交易的金额并将其存储 下面是屏幕的外观: 有什么答案/解决方案吗?我感谢你的帮助 <? $command = 'getTransa
- 主要任务是从Sage Pay Reporting API中检索数据—工作起来很有魅力
- 从xml输出文件读取并收集变量-不起作用
<?
$command = 'getTransactionList';
$vendor = 'vendorname';
$user = 'username';
$password = 'pwd';
$startdate = '01/05/2013 00:00:01';
$enddate = '31/05/2013 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 = simplexml_load_string($result);
echo $rxml->transactions->transaction[0]->amount;
?>
<HTML>
<BODY>
<form method="post" action="https://test.sagepay.com/access/access.htm">
<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>
交易->交易[0]>金额;
?>
替换$rxml=simplexml\u load\u字符串($result)
与
$rxml=newsimplexmlement
($result) 显示您在$result
中获得的XML(删除任何财务或个人数据)。如果您想解析XML,重要的不是您如何连接到外部计算机下载数据,而是下载的XML数据的外观(您没有说)。谢谢您MrCode和阿尔瓦罗。当我注意到我需要有10个声誉才能展示出来时,我已经在我的帖子中有了输出。您可以通过上面的链接找到输出xml格式。捕获列出的所有交易的所有“金额”还是仅捕获第一笔交易?你说的商店是什么意思?在DB/文件/cookie/会话中?当您运行代码时,金额是否会回显?