Solved

Trying to POST data to a second cgi from a perl script.

Posted on 1997-12-19
2
422 Views
Last Modified: 2013-12-25
We have an HTML form which collects data (Name, address etc..)  this calls a standard perl script which creates other data automatically, this inturn has to send 4 of these fields to another cgi script (Written in C). The cgi script written in C can be called directly from HTML.

We have made a temporary workaround by creating a HTML page in between which inturn calls the the second cgi script. This works fine....

We would like to eliminate the HTML page in between scripts.

Any ideas ?
0
Comment
Question by:tessel
2 Comments
 
LVL 1

Accepted Solution

by:
rets earned 100 total points
ID: 1831711
When you print your HTTP Headers you usually say something like:

print "Content-type: text/html\n\n";

This should be the very first thing you print.  Instead you could print:

print "Location: http://www.myserver.com/cgi-bin/my.cgi?this=that&the=other">

This tells the browser to go to www.myserver.com/cgi-bin/my.cgi and pass those URL encoded items to my.cgi.  This should be the only thing printed in your CGI as the browser will be redirected to the specified location.

For more information on URL encoding you can see O'Reilly's Webmaster in a Nutshell pp.76-78.

-K

0
 
LVL 84

Expert Comment

by:ozo
ID: 1831712
You might also call
  $ENV{QUERY_STRING} = "this=that&the=other";
  exec("my.cgi");
directly from your perl script.

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question