我调用了SoapClient,响应应该是$Transaction_Code
,但没有任何内容从cashu>>>返回有什么帮助吗?
<?php
ini_set("soap.wsdl_cache_enabled", "0");
ini_set('customer_agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0)Gecko/20100101 Firefox/20.0');
//The above line will add the User-Agent to the header of your request, and the soap library 'SoapClient' will add the Host header nameautomatically.
$merchant_id = 'system';
$encryption_key = 'recharge';
$amount = 100; // This value will be posted from the above HTML page
$currency = 'SAR';
$display_text = 'Hello 111222212121';
$language = 'en';
$session_id = 'boody'.rand(0000,9999);
$txt1 = "item";
$testmode = 0;
// The below Parameters are not required, especially in the default Merchant Checkout Page:
$txt2 = '';
$txt3 = '';
$txt4 = '';
$txt5 = '';
$service_name = 'Default';
// If using Enhanced Encryption:
$token = md5(strtolower($merchant_id) . ':' . $amount . ':' .
strtolower($currency) . ':' . strtolower($session_id) . ':' . $encryption_key);
if($testmode == 0){
$domain_url = "https://sandbox.cashu.com/secure/payment.wsdl";
}else{
$domain_url = "https://secure.cashu.com/payment.wsdl";
}
$client = new SoapClient($domain_url, array('trace' => true));
// Change the URL to "https://secure.cashu.com/payment.wsdl" for Live Area.
// $request = $client-> DoPaymentRequest($merchant_id, $token, $display_text, $currency, $amount, $language, $session_id, $txt1, $txt2, $txt3, $txt4, $txt5, $testmode, $service_name);
$request = $client-> __soapCall('DoPaymentRequest',$merchant_id, $token, $display_text, $currency, $amount, $language, $session_id, $txt1, $txt2, $txt3, $txt4, $txt5, $testmode, $service_name);
//The Parameters must be in this order: merchant_id, token,display_text, currency, amount, language, session_id, txt1, txt2, txt3,txt4, txt5, test_mode, service_name
//Get transaction code from the response
$tmp = strstr($request, '=');
$Transaction_Code = substr($tmp, 1);
echo $Transaction_Code;
?>
答案 0 :(得分:0)
__soapCall的第二个参数接受数组中的参数。因此,您必须以数组形式发送所有reqeust参数。 http://php.net/manual/en/soapclient.soapcall.php