首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Curl Virtual Merchant

Curl Virtual Merchant
EN

Stack Overflow用户
提问于 2013-10-25 20:45:27
回答 2查看 909关注 0票数 1

我正在尝试通过curl call设置Virtual Merchant。

代码语言:javascript
复制
$url = 'https://demo.myvirtualmerchant.com/VirtualMerchantDemo/process.do';

$request = curl_init($url); // initiate curl object
            curl_setopt($request, CURLOPT_POST, 1);
            curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
            curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
            curl_setopt($request, CURLOPT_POSTFIELDS, $fields_string); // use HTTP POST to send form data
            curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
            curl_setopt($request, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($request, CURLOPT_FOLLOWLOCATION, 1);
            $post_response = curl_exec($request); // execute curl post and store results in $post_response
            curl_close ($request); // close curl object

            print_r($post_response);die();

字段设置正确。

当我执行这段代码时,它首先将我重定向到空白页面,然后刷新,但在刷新之后,我请求了如下参数: perfect-process-status.php?ssl_email=&ssl_status=TEST+MODE&ssl_cvv2_response=P&...以此类推。

var_dump结果(重定向前)

字符串(1504)“”

EN

回答 2

Stack Overflow用户

发布于 2013-11-06 16:50:30

添加这个: curl_setopt($request,CURLOPT_RETURNTRANSFER,true);

票数 0
EN

Stack Overflow用户

发布于 2015-10-06 22:09:43

我的工作是虚拟商家网关。

代码语言:javascript
复制
$url = 'https://demo.myvirtualmerchant.com/VirtualMerchantDemo/process.do';
$fields = array(
'ssl_merchant_id'=>'Enter the virtual merchant id',
    'ssl_user_id'=>'Enter the user id',
    'ssl_pin'=>'Enter the pin number',
    'ssl_show_form'=>'false',//if it is true Converge virtual merchant send one form.
    'ssl_transaction_type'=>'ccsale',
    'ssl_avs_address'=> 'Enter ur address',
    'ssl_avs_zip'=> 'Enter ur zip code',
    'ssl_email'=>'Enter ur email id',
    'ssl_first_name'=>'Enter ur first name',
    'ssl_last_name'=>'Enter the last name',
    'ssl_state'=>'Enter state',
    'ssl_amount'=>'Enter amount details',
    'ssl_card_number'=>'Enter Account card number',//For Dummy card number: '5123456789012346'  
    'ssl_exp_date'=>'Enter Expire date of card',//For Dummy expire date: '0522'
    'ssl_cvv2cvc2'=>'Enter cvc number',//Dummy cvv number: '100'
    'ssl_invoice_number'=>'Enter Invoice number',       
);
$fields_string = http_build_query($fields);
//open curl session
$ch = curl_init();
//begin seting curl options
//set URL
curl_setopt($ch, CURLOPT_URL, $url);
//set method
curl_setopt($ch, CURLOPT_POST, 1);
//set post data string
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
//these two options are frequently necessary to avoid SSL errors with PHP
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//perform the curl post and store the result
$result = curl_exec($ch);
//close the curl session
curl_close($ch);}

您必须将值添加到$fields_string,如果没有值,则它将显示为空。如果你想了解更多虚拟商家,请访问:here。在pdf中还包含Php代码

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19590259

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档