此代码用于将详细信息发送到支付网关。当我使用我的普通表单的代码时它工作正常但是当它在PHP中使用cURL时它不起作用并给出结果"对象被移动"。
我的问题的解决方案是什么?如何在交易快递网关中使用cURL进行付款转帐?
以下是导致此问题的代码:
function httpPost($url,$params)
{
$postData = '';
//create name value pairs seperated by &
foreach($params as $k => $v)
{
$postData .= $k . '='.$v.'&';
}
rtrim($postData, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$output=curl_exec($ch) or die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
curl_close($ch);
return $output;
}
$params = array(
"HostedKey" => "xxxxxxxxxxxxxxxxxxx",
"Gateway_ID" => "xxxxxxxx",
"IndustryCode" => "2",
"Amount" => "",
"RecurringType" => "N",
"RecurringAmount" => "",
"RURL" => "http://www.example.com",
"CURL" => "http://www.example.com",
"AVSRequired" => "N",
"CVV2Required" => "Y",
"EmailRequired" => "Y",
"PostRspMsg" => "N",
"FullName" => "my name",
"CustRefID" => "11111111"
);
echo httpPost("https://hosted.transactionexpress.com/Transaction/Transaction/Index/",$params);
答案 0 :(得分:0)
我认为出于安全原因存在ssl问题
您必须执行类似
的操作curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
OR
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
答案 1 :(得分:0)
这适用于我支付PayPal付款的情况:
<pages
buffer="true"
masterPageFile="~/masterpages/Main.Master"
enableEventValidation="false">
</pages>
答案 2 :(得分:0)
为什么要使用卷曲?这是一种消费API的过时方式。
使用SOAP WSDL进行更健壮的OOP方法检查我的示例
https://github.com/rojobo/TransactionExpressPHP
问候
答案 3 :(得分:0)
还有另一种选择来拨打Transaction Express支付通道。 我们以sendTran方法为例。 代码将如下所示。
$client = new SoapClient("https://ws.cert.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl",array('exceptions'=>FALSE));
$params = array("tranCode" => 1,
"reqAmt" => 0200
);
$SendTran = $client->__soapCall("SendTran", array("parameters" => $params));