Solved

CGI - Echo of Post Data - Environment Variables

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
removing hyperlinks from end-notes in a PDF to HTML conversion 8 79
Linux Scripting 3 95
cookies analysis tools 2 65
AWS CLI issues with Tags 3 62
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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.
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:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

948 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

21 Experts available now in Live!

Get 1:1 Help Now