Solved

CGI - Echo of Post Data - Environment Variables

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

Suggested Solutions

Title # Comments Views Activity
Animated .jpg? 13 97
powershell code to list items in dropdown 6 90
Redirecting an Outlook attachment to a specific folder? 3 58
BATCH to EXE Converter 2 40
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

820 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