Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CGI - Echo of Post Data - Environment Variables

Posted on 2000-05-08
3
Medium Priority
?
437 Views
Last Modified: 2013-12-25
I used to have a site that I could bounce my http form (post) request against and it would return a page that would include all the cgi environment variables -- in addition to the post string of form variables.  
That site is no longer live.  Can anyone give me an URL which does the same thing?     (or a vbscript .ASP which I can run on my IIS server?)

Thanks!
0
Comment
Question by:gorndog
  • 2
3 Comments
 

Expert Comment

by:hualian
ID: 2790684
Give you a script:
This is URL:
http://alleasy.net/cgi-bin/getform.pl

make sample form code:

<FORM method="POST" action="http://alleasy.net/cgi-bin/getform.pl">
  <P><INPUT type="text" name="T1" size="20"><INPUT type="submit" value="submit" name="B1"><INPUT type="reset" value="reset" name="B2"></P>
</FORM>

if you have any problem, please say.


This is Source code of getform.pl:

#!/usr/bin/perl
use CGI;
$hoyi=new CGI;

print $hoyi->header;
print $hoyi->start_html('CGI Enviroment!');
## Print all you post var
print $hoyi->dump;
## print all Env var
print "\n<pre>\n";
foreach (keys(%ENV)) {
      print "$_ = $ENV{$_} \n";
}
print "\n</pre>";
exit;

0
 

Accepted Solution

by:
hualian earned 300 total points
ID: 2790706
Give you a script:
This is URL:
http://alleasy.net/cgi-bin/getform.pl 

make sample form code:

<FORM method="POST" action="http://alleasy.net/cgi-bin/getform.pl">
  <P><INPUT type="text" name="T1" size="20"><INPUT type="submit" value="submit" name="B1"><INPUT type="reset" value="reset" name="B2"></P>
</FORM>

if you have any problem, please say.


This is Source code of getform.pl:

#!/usr/bin/perl
use CGI;
$hoyi=new CGI;

print $hoyi->header;
print $hoyi->start_html('CGI Enviroment!');
## Print all you post var
print $hoyi->dump;
## print all Env var
print "\n<pre>\n";
foreach (keys(%ENV)) {
      print "$_ = $ENV{$_} \n";
}
print "\n</pre>";
exit;



0
 

Author Comment

by:gorndog
ID: 2791195
That URL doesn't list the string of "post data".  The reason I wanted that is so that I can put into my html a single link that does the exact same thing as the form post would do.  Thus if I can see the post string that the browser issues when I click on the form's submit, then I will know what my link needs to say.

The URL you provide does have a line for "QUERY_STRING" .., which shows what I would want for a "GET" request, but the URL doesn't show the form variables like that if it is a "POST" request.

That perl could probably be tweaked to generate the equivalent POST DATA into a string ..., but I did a bit more searching and found this URL:

http://www.neosoft.com/neowebscript/tests/environment.html

It handles both GET and POST requests.

Thanks so much for your answer and Perl script -- they both came in very handy!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

886 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