Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

post and get

by hotshot (Prior)
on Mar 18, 2002 at 08:13 UTC ( #152422=perlquestion: print w/ replies, xml ) Need Help??
hotshot has asked for the wisdom of the Perl Monks concerning the following question:

Hello guys !

I have a CGI script, and I'v been wanting to know if there's a way to know if a parameter I got from the browser, was sent to me in POST or GET method.

Anyone?

Hotshot

Comment on post and get
Re: post and get
by blakem (Monsignor) on Mar 18, 2002 at 08:16 UTC
    Check the value of $ENV{REQUEST_METHOD}

    -Blake

Re: post and get
by busunsl (Vicar) on Mar 18, 2002 at 08:25 UTC
    Use the CGI module and you don't have to bother about the request method.
    But if you need it anyway, use CGI's request_method() function.
Re: post and get
by Juerd (Abbot) on Mar 18, 2002 at 09:53 UTC

    was sent to me in POST or GET method.

    Blake already gave a perfect answer, but I'd like to add that %ENV is loaded with useful information. Give the following piece of code a try to find out more about this wonderful hash.

    use Data::Dumper; print Dumper \%ENV;

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

Re: post and get
by tomhukins (Curate) on Mar 18, 2002 at 09:53 UTC
Re: post and get
by newrisedesigns (Curate) on Mar 18, 2002 at 22:08 UTC

    Whenever you write something in Perl for use as a CGI application, it's always best to use CGI.pm. The module is in almost every distrobution, and it doesn't cause too much of a delay (if speed is your concern.)

    CGI.pm will also handle your queries for you, and can determine GET from POST and vice-versa.

    All the instructions for use are right here, and I'm sure any monk here will help you if you need it.

    Hope this helps.

    John J Reiser
    newrisedesigns.com

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://152422]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2014-10-23 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls