Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 1997-12-19
2
427 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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

791 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