- 2076 Chaitra · 5 marks
Difference between GET and POST
Short answer
GET retrieves data with parameters in the URL; it can be cached, bookmarked, and is limited in size and less secure. POST sends data in the request body for processing, has no practical size limit, supports binary, and is normally not cached. Use GET for searches and POST for logins or uploads.
What is the difference between GET and POST request?
GET and POST are HTTP request methods. GET asks the server to retrieve a resource; POST sends data to the server to be processed (create or update).
| Basis | GET | POST |
|---|---|---|
| Purpose | Retrieve data | Submit data for processing |
| Data location | In the URL query string (?name=ram&age=20) | In the HTTP request body |
| Visibility | Visible in the address bar and history | Not shown in the URL |
| Security | Less secure; do not send passwords | More secure (still needs HTTPS for real protection) |
| Data size | Limited by URL length (about 2000 chars) | No practical limit |
| Data type | Only ASCII text | Text and binary (file upload, multipart/form-data) |
| Caching | Can be cached | Normally not cached |
| Bookmarking | Can be bookmarked | Cannot be bookmarked |
| Idempotent | Yes; repeating gives the same result | No; repeating may create duplicates |
| Back/refresh | Harmless | Browser warns about resubmission |
Example:
<form method="get" action="search.php">...</form> <!-- search.php?q=web -->
<form method="post" action="login.php">...</form> <!-- data in body -->
Use GET for searches and filters; use POST for logins, registration forms and file uploads.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Preliminary estimate: two-storied health post · Estimating and Costing, chapter 3