Teamwolf2000 Posted October 31, 2007 Share Posted October 31, 2007 Hi, I am currently finishing a intergration with a third party payment gateway and my own bespoke shopping cart. Currently:- My checkout process page adds all the order and customer data to my database tables. There is an HTML form in the HTML of that page that is submitted by javascript onload that posts the required data I have already collected to the Payment Gateway. On sucsessfull payment, the Order in the database is flaged as paid. Process completed. It all works fine, But I dont like using javascript to post the form and I dont like having the form data visable. I had a look around and it seems I should be using Curl to post the data to the Payment Gateway. I can get my curl script to work and post all the data to the payment gateway, but... It is returning the HTML and displaying it in the page. I would really like it to post to the payment page and follow it to it. The Payment gatway page is on https and my page is not. So is asks for payment details on http not https. Does anyone know what i should do to make Curl go to the page rather than display it? Here is the Curl code, I have not put the details in for security reasons. But it all works and displays the page. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://$URL"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookiefile"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookiefile"); curl_exec ($ch); curl_close ($ch); Any suggestions would be great. Thanks very much. TW Quote Link to comment https://forums.phpfreaks.com/topic/75479-php-curl/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.