我提出了另一個問題認爲這不過在此之前....這裏是準確的捲曲設置你必須做的......
我意識到變量可以更好地和我應該把它作爲一個對象,但我只想在那裏得到一個快速答案。該腳本還需要通過篩選不同的接受和錯誤消息,但是這是我這麼遠......
$ch = curl_init();
$url = "https://secure2.epdq.co.uk:11500"; // Don't need to add curl_setopt($curlSession, CURLOPT_PORT, 443); as port is included
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); // $vars is your XML
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close ($ch);
$xml = new domDocument;
$xml->loadXML($data);
if (!$xml) {
echo 'Error while parsing the document - Please Contact to determine if payment has gone though';
exit;
}
$x = $xml->getElementsByTagName("CcErrCode");
$approved = $x->item(0)->nodeValue;
$xx = $xml->getElementsByTagName("CcReturnMsg");
$CcReturnMsg = $xx->item(0)->nodeValue;
if($approved) {
// the card is valid.
$y = $xml->getElementsByTagName("Id");
$BCardId = $y->item(1)->nodeValue;
$z = $xml->getElementsByTagName("MessageList");
$MessageList = $z->item(0)->nodeValue;
$zz = $xml->getElementsByTagName("AvsRespCode");
$AvsRespCode = $zz->item(0)->nodeValue;
$zzz = $xml->getElementsByTagName("AvsDisplay");
$AvsDisplay = $zzz->item(0)->nodeValue;
$zzzz = $xml->getElementsByTagName("ProcReturnMsg");
$ProcReturnMsg = $zzzz->item(0)->nodeValue;
if($approved == "1"){
echo "approved!<br />";
echo "BCardId: " . $BCardId . ", MessageList=" . $MessageList . ", " . $AvsRespCode . ", " . $AvsDisplay . ", " . $ProcReturnMsg;
die();
}else{
// raise that it's been partially accepted,
echo "partially approved";
echo "BCardId: " . $BCardId . ", MessageList=" . $MessageList . ", " . $AvsRespCode . ", " . $AvsDisplay . ", " . $ProcReturnMsg;
die();
}
}else{
echo "you have been completely knocked back";
$zzzzz = $xml->getElementsByTagName("Text");
$BCard_Text = $zzzzz->item(0)->nodeValue;
echo "The reason:" . $BCard_Text;
die();
}
希望這有助於誰必須設置此別人!
我懷疑你覺得沒有什麼的原因是因爲巴克萊想保持這種不是出於安全原因的公共領域。我建議你在這種情況下聯繫他們,除非你得到一般錯誤。 – 2011-04-25 14:27:26