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!

Response goes back to another script

Status
Not open for further replies.

thillside

IS-IT--Management
Jan 27, 2004
7
US
Here is my situation.


Client fills out form and sends it to perl script (S1) on my server.

S1 sends info off to "foreign" server (a credit card processor).

The foreign server is configured to send approvals to one script (call it S2) with approval and another script (S3) with a disapproval.

Now how do I get from S2 or S3 back to the user?

I suppose I could have S1 (which has the connection to the user) wait until it sees something from S2 or S3, but I hate that kind of token system, it is difficult and prone to error. (I do some MySQL in this system, so I could use that I suppose.) I understand that PHP can handle this by somehow keeping the connection, but I don't want to re-write stuff.

 
Why not just put a redirect in S2 and S3. Here is an eg:

Code:
[COLOR=green]
#!/usr/bin/perl

***ALL YOUR PROCESSING AND DATABASE STUFF ETC...***

print <<EOHTML;
Content-type: text/html\n\n
               
                <script language=&quot;JavaScript&quot;>
                        <!--
                        function redirectPage() {
                                window.top.location='[URL unfurl="true"]http://your.first-script.com';[/URL]
                        }
                        -->
                </script>
                
                <HTML>
                <BODY onLoad=&quot;redirectPage()&quot;>
                <CENTER><H2>Please Wait While Loading...</H2></CENTER>
                </BODY>
                </HTML>
EOHTML
[code][/color]

Hope this is what you were looking for.

Sean.
 
That just brings me to another instance of the first script. My problem is that the first script is the only thing with the connection to the client. I suppose there is something I could do with named pipes or something.

 
Correct me if I'm wrong but if S1 doesn't pipe to your credit card processor than S1 terminates as soon as it sends it's data to your credit card processor.

There's always a better way. The fun is trying to find it!
 
S1 does an HTTP request, it survives the request and waits for a response. The problem is that the response, for some quite odd reason (I have a call into their less than wonderful tech support) does to the S2 or S3.

Oh, well, back to my old programming days. The solution I see is for S2/S3 to write the status to the MySQL DB. S1 will wait for that response (or time out after some short time).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top