CURL Post Along with redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rossriley
Forum Newbie
Posts: 3
Joined: Thu Aug 05, 2004 9:41 am

CURL Post Along with redirect

Post by rossriley »

Hello people,
I'm trying to connect with a payment processing interface.
The process is as follows.....
The user enters their personal information, accepts terms and conditions etc and then clicks on proceed to payment.
What i need to do is send a form to the payment processor that contains all the order information and also a hash of the order which they check for security.
So after the user presses the form submit i need to take the form variables and add my own before posting on to the payment interface.

Now I can do this with CURL and send the POST variables no problem, the only hitch is that the user stays on my page and doesn't get forwarded to the Payment processors site.

How do i go about doing this as if the user had submitted the form directly and they get directed to the other site without knowing what variables i have added?

Thanks for any input
Ross
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Well, what says support team of your processor on this matter? I doubt we can help you without their specifications at hand...
rossriley
Forum Newbie
Posts: 3
Joined: Thu Aug 05, 2004 9:41 am

Post by rossriley »

It's not an issue for them, all they need is a single post to their url where the user goes on to enter their card details.
The post data has to be sent along with the user, and i will get sent a return post containing an authorisation code.

What my problem is is how to POST all my info to their url as obviously i can't sent things like the transaction amount and currency in hidden form fields.

Now i can do this using CURL, i've sent the data to one of my own pages which stores the POST variables in my database. So i know that works ok, all i need to be able to do is send the user to the url along with the data.

Any ideas?

Ross
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

run a post through curl, output a header and html that redirects the user..
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

feyd wrote:output a header and html that redirects the user..
redirect where, huh? ;)

Perhaps you need to present the user with a form containing all the data in hidden fields with single submit button. In action form attribute specify the url of your processor's payment form...
rossriley
Forum Newbie
Posts: 3
Joined: Thu Aug 05, 2004 9:41 am

Post by rossriley »

yes but the problem with this is that the transaction amount is in a hidden field, surely there's a more secure way of doing this?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Weirdan wrote:redirect where, huh? ;)
hmm.. to the payment processor's form, maybe? :P
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

feyd wrote:
Weirdan wrote:redirect where, huh? ;)
hmm.. to the payment processor's form, maybe? :P
Without any data? I can't believe it.
rossriley wrote: yes but the problem with this is that the transaction amount is in a hidden field, surely there's a more secure way of doing this?
doesn't your processor require a hash signature or something?
Post Reply