|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Here is what I am trying to do:
1. I have a HTML file with a form that posts to file2.cgi file2.cgi only supports form-input, so no parameters. I do not have access to file2.cgi, so I cannot change it. 2. I want the form to go through my file1.cgi file first, so I can log the statistics. Question: How can I pass the information from file1.cgi to file2.cgi? Remember, I can not change file2.cgi!!! Is it even possible? If not, do you think it is in PHP? ![]() |
|
#2
|
|||
|
|||
|
Jorden,
Most likely this is possible. Can you post your HTML code? Bob |
|
#3
|
|||
|
|||
|
HTML code...
============================================
<FORM METHOD=post ACTION="http://195.81.38.162/OTA/RTTTL/1725217328"> <input type="hidden" size="30" NAME="composer" VALUE="16C2 16C1 16C1 16- 8C1 8- 8C1 8D1 8E1 8B1 8- 8B1 8- 8B1 8- 8B1 16C2 16C1 16D1 16D1 16C1 16C1 16C1 16- 8C1 16- 16C1 8C1 8D1 8E1 8D1 8- 8D1 8- 8D1 16F1 16- 16F1 16- 16E1 16- 16B1"> <input type="hidden" size="30" NAME="title" VALUE="Exploratio"> <input type="hidden" size="30" NAME="tempo" VALUE="160"> <input type="hidden" value="http://www.mobileringtonez.com/nl/success.shtml" size="10" name="url_success"> <input type="hidden" value="http://www.mobileringtonez.com/nl/error.shtml" size="10" NAME="url_failure"> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2> <TR><TD><FONT FACE=Arial SIZE=2>Ontvanger:</TD><TD><input type="text" name="recipient" value="316"></TD></TR> <TR><TD><FONT FACE=Arial SIZE=2>Code:</TD><TD><input type="text" name="authcode"></TD></TR></TABLE> <input type="submit" value="Versturen"> </form> ============================================ This was the original form. However, now I want it to go through my own .cgi file .... |
|
#4
|
|||
|
|||
|
Consider this approach...
1. Original HTML Form calls your logging cgi script. 2. Your logging script creates and outputs a new HTML page in response, which presents itself as a "Verify Your Information" page. Some form elements will still remain hidden. Be sure to pass the original values back to the same form names in this step. 3. Have your user click a button confirming the information or they click another button that will return them to the original HTML form page. If you would like the example code, let me know. This will add one extra web page, but will be disguised as Value-Added Service on your part. ![]() Bob |
|
#5
|
|||
|
|||
|
Shorter solution
I've done something similar to this before without having to use a confirmation page.
In your file1.cgi you would use LWP::UserAgent and simulate a browser. More documentation on LWP can be found at perldoc.com and searching for LWP::UserAgent. Your code would look some thing like this: #!/usr/bin/perl use LWP::UserAgent; # Create UA Object $ua = LWP::UserAgent->new; $ua->agent("MyAgent"); # Request type: POST,GET etc... my $req = HTTP::Request->new(POST => 'http://www.server.com/url/to/file2.cgi'); $req->content_type('application/x-www-form-urlencoded'); # Declare Variables to Post $req->content("value1=$value1&value2=$value2"); # Send Request $request = $req->as_string; my $res = $ua->request($req); $result = $res->as_string; print "Content-Type: text/html\n\n"; print "$result\n"; THats a little crude but you get the idea. Basically you're taking all the info they submitted then posting it to another script using this one. Then the result sent from file2.cgi would then be piped through this script and to the client. Works very well.. Hope this helps
__________________
"Mankind cannot define memory, yet it defines mankind" |
|
#6
|
|||
|
|||
|
Thank you both for your replies. Ofcourse, the confirmation thing is a very good idea that I hadn't thought of myself...but I think the second reply will fit my needs better, so I will try that out ASAP!
Thanks! |
|
#7
|
|||
|
|||
|
Thanks dkode, it worked fine!!!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > HTML form -> script -> script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|