Hi,
I am currently finishing integration 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 successful payment, the Order in the database is flagged as paid. Process completed.
It all works fine, But I don’t like using JavaScript to post the form and I don’t like having the form data visible. I had a look around and it seems I should be using cURL to post the data to the Payment Gateway. Unless someone could suggest a better way.
I can get my cURL code 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 gateway 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 results in 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
1 1596 pbmods 5,821
Recognized Expert Expert
Heya, TeamWolf. Welcome to TSDN!
Change this line: -
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
-
to this: -
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
-
Then use header() redirection to go to the 'payment processed' page.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Haluk Durmus |
last post by:
Hello
I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php
from cvs.
php couse an ERROR
I did the following steps:
|
by: mrbog |
last post by:
1. In order to make an http (or https) request with PHP, I need to
recompile php with cURL.
2. In order to install CURL I have to upgrade my openssl rpm, even
though I'm runing a version of linux that's only like 3 months old
(fedora c2 stable), because curl needs libcrypto.so.4.
3. In order to install libcrypto.so.4 I have to upgrade my openssl
(took me forever to figure that out).
|
by: Chris Fortune |
last post by:
# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28
17:12:37
MSD 2004 i686 i686 i386 GNU/Linux
I recompiled PHP with mcrypt, openssl, and curl
phpinfo(): http://www.canadiandropshipping.com/hello.php3
Does anyone know why this ssl curl test fails?
http://www.canadiandropshipping.com...t/diag_curl.php
|
by: Hans |
last post by:
Hi everybody,
I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?
Here is what I tried but the result is always the login page.
$curl=curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
by: Shutdownrunner |
last post by:
I want to store result of curl in a variable, which means to store a
webpage in a variable in order to parse it later and get our some useful
information. But unfortunately I'm not too experienced in C and I'm
making some stupid mistake. Could someone help me solve it?
#include <string.h>
#include <curl/curl.h>
size_t write_data(const char *buffer, size_t size, size_t nmemb, char
*userp)
| |
by: nfhm2k |
last post by:
I've been trying to find a solution to this for quite some time now...
I even took a look at existing scripts...
Including this one...
http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2
Everyone on that post seems to say its to do with the cookie's, yet if
infact they had tried this script they would have found that even with
the cookies enabled this...
|
by: Terry |
last post by:
I'm using curl to invoke a php script on the same site/server. It works
great, but if I call it again while it's still running, nothing happens.
Why? Can that be fixed?
Why use curl? To make it run in the background. My host can't use exec
nor flush the output to the browser. But, I can use curl and timeout.
|
by: zorro |
last post by:
Hello there,
I can't figure out why is it that when i use an array for my postfields
it doesn't work :
this works
curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" );
this doesn't
curl_setopt($curl, CURLOPT_POSTFIELDS, array('clown'=>'bozo') );
|
by: xerc |
last post by:
I am trying to create a generic function I can call to download all files from a single remote FTP directory -- using CURL. I want to multi-thread it, but need to get the single thread functionality working first before I tackle that. Anyway, in my function I can list all the files, but the function I have, no matter how I try, will only return one file -- the last file. My for() loop seems pretty straightforward, so not sure why only the...
|
by: rottmanj |
last post by:
I am re-writing my rets application in perl, and I have found a few modules that will help me on my way. One of them being WWW::Curl:easy.
During my testing, I have tested both system curl and perl curl. At this point I can get the system curl to correctly connect to my server. However, I am having the hardest time trying to figure out why I cant get perl curl to connect to the server.
Every time I try to connect, I get a 401 error. I am...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |