Welcome Guest, Not a member yet? Register   Sign In
cURL POST and Redirect to new page Problem
#1

[eluser]tkaw220[/eluser]
I am working on a eCommerce project, where I need to POST information to payment gateway. My codes below perform cURL POST and successfully contacted the payment request page, but the page does not redirected to payment page completely (URL in the browser address bar remain as my site). Although the page display the form to collect payment from buyer, but it tries to load assets (images, validation JS scripts) from my server, and NOT from the payment gateway server.

$postdata = array(
‘MerchantCode’ => $MerchantCode,
‘PaymentId’ => $this->session->userdata(‘payment_method’),
‘RefNo’ => $RefNo,
‘Amount’ => $Amount,
‘Currency’ => $Currency,
‘UserName’ => $this->session->userdata(‘billing_first_name’),
‘UserEmail’ => $this->session->userdata(‘email’),
‘UserContact’ => $this->session->userdata(‘billing_mobile’),
‘Lang’ => ‘UTF-8’,
‘Signature’ => $Signature,
‘ResponseURL’ => site_url() . ‘/order/payment_response’
);

$this->load->library(‘Curl’);
$this->curl->create($PaymentRequestURL);
$this->curl->option(CURLOPT_REFERER, site_url() . ‘/order/review_order/’);
$this->curl->option(CURLOPT_FOLLOWLOCATION, 1);
$this->curl->post($postdata);
echo $this->curl->execute();

I used the cURL library for CI written by Philip Sturgeon.

I searched for cURL redirect problem and found this link, http://www.phpbuilder.com/board/showthre...t=10299554. The user and I is having the same problem.

How do I fix the code so it redirected to payment request page completely? If cURL cannot perform ordinary form HTTP POST and redirect to new site at the same time, what are other alternatives do I have?

Many thanks.




Theme © iAndrew 2016 - Forum software by © MyBB