Build and send POST data

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
superpwnage
Forum Newbie
Posts: 1
Joined: Fri Jul 02, 2010 5:03 pm

Build and send POST data

Post by superpwnage »

First off, hello PHPDN, nice to meet you :).

I am working with authorize.net (SIM implementation) to process e-commerce orders. During this process, customer information on our site is collected via a checkout form and then sent by POST (submitting a form) directly to authorize.net where they will collect and process the customer's credit card information. What I need to do is have a step in-between where I can server-side validate and sanitize user input (amongst other things). I do currently have Javascript validation, which works great but can't be relied upon if a customer has disabled Javascript in his or her browser. Also, I know that I could send an ajax script to accomplish this, but again I do not want to rely on Javascript.

What I'd like to do is have the form POST it's data to another page on our site to be processed, which silently builds the sanitized data and (if validated) POSTS that data visibly (as if the browser submitted the form) to the external authorize.net server. Is this possible? Would you implement this differently? I'm open to ideas.

Cheers,
Ben
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Build and send POST data

Post by AbraCadaver »

You're not going to be able to post data from a form to a PHP script and then automatically post that to somewhere else and have the user's browser direct to the somewhere else without javascript. If you want to post to that somewhere else, but the user stays on the original page that received the form post then that is doable without javascript.

You could however have a form that posts to a script that validates and then displays another form that says "please confirm your info and click submit" that then posts to the other site.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Build and send POST data

Post by Jonah Bron »

This is a tough one. The trouble is, even if you do this, a malicious user could still spoof the post fields. You may have to opt for the submit-info-via-cURL implementation (don't remember what it's called).
Post Reply