Solved

CGI - Echo of Post Data - Environment Variables

Posted on 2000-05-08
3
407 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 100 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now