Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

(Ovid) Re: POST vs GET & their intermingling.

by Ovid (Cardinal)
on Dec 29, 2000 at 21:19 UTC ( #48842=note: print w/replies, xml ) Need Help??

in reply to POST vs GET & their intermingling.

GET and POST are not interchangeable and shouldn't be used as such. Proxy servers may cache the output of GET requests, browsers should prompt you if you hit refresh on a POST, and the two types are different. In practice, the only distinction that most notice is that POST requests are not logged, but GET requests are (since the query string is in the headers).

If you are using and need to use a POST but still have a query string embedded in the URL, open and look for the following:

# Some people want to have their cake and eat it too! # Uncomment this line to have the contents of the query string # APPENDED to the POST data. # $query_string .= (length($query_string) ? '&' : '') . $ENV{'QU +ERY_STRING'} if defined $ENV{'QUERY_STRING'};
As a general rule of thumb, use GET when you *get* information from a server without changing it. Use POST when you *post* information to a server and thus change it. That's why we have two methods.

If you must mix and match methods, make sure that you don't use GET when you alter data on the server! Since browsers generally do not prompt on reload for a GET request, a user could inadvertently refresh a page and post data multiple times. Some browsers still allow this for a POST, but it's less common.


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: POST vs GET & their intermingling.
by Fastolfe (Vicar) on Dec 29, 2000 at 21:56 UTC
    In addition, some (goofy) proxy servers periodically re-fetch pages retrieved via GET to keep their cache up to date I guess. As Ovid says, GET should be used when you're just fetching information, and it doesn't matter how many times that data is fetched. POST should be used whenever you want to activate an action or change data, anything that should only be done once and with the explicit activation by a browser.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://48842]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2022-01-20 10:16 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (56 votes). Check out past polls.