0

この質問は Sage Pay 固有の質問ではないと思いますが、私の問題に関連して言及されているので、このトリッキーな問題を解決できることを願っています.

これが私がやりたいことです:

  • 主なタスクは、Sage Pay Reporting API からデータを取得することです。
  • xml 出力ファイルから変数を読み取って収集する - 機能しない

以下のコードは、私を Sage Pay サイトにリダイレクトした後のトランザクションのリストを示していますが、たとえば単一のトランザクションの金額を取得して保存する方法がわかりません。

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>
4

1 に答える 1

1

$rxml = simplexml_load_string($result); を置き換えます。

$rxml = 新しいSimpleXMLElement($結果);

于 2013-11-23T07:11:45.693 に答える