Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing CGI output

Status
Not open for further replies.

siwy202

Programmer
Sep 11, 2003
1
US
I'm new to CGI but here's the problem I'm having

I wrote a PHP page where a user enters Credit Card relevant information. The data is sent using the POST method to a CGI script (This CGI script is provided to me from the credit card processing company). Now, The CGI script validates information - it does what it is supposed to. Then the CGI script sends back an HTTP response to the browser. To the normal user the page looks blank but the page is full of <input type=&quot;hidden&quot;> fields. What I want to do is PARSE these fields so that my own PHP page can report whether the user's credit card was authorized for example.

Note that I cannot modify the CGI script. SO is there a way so that I can &quot;listen&quot; to CGI output and then parse it and display it on the page?

Thanks,
Tom
 
The easiest way is probably going to be wrapping the page in javascript, having the javascript read these fields and redirecting the browser or doing a behind the scenes connection.

The way I handle this is a bit harder. I write a CGI that interacts with the user. The user sends MY CGI their info, I then turn around and send the info to the cc company and get the info back. I either read the result or parse the page that comes back, log actions and then return whatever I want to the user.

In short, I do not let me users speak directly to my vendors. This gives my software more control of the situation and allows me to easily change CC processors without rebuilding any userland code.
 
You shouldn't be sending CC information over HTTP, but rather over HTTPS, because the information can be listened to by unauthorised parties.

Regards
--Paul
 
Yes, PaulTEG has a good point, never use HTTP for anything CC related.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top