Course contentsShow
Web Development
Lesson 8 of 2,9821. The Web Platform FoundationFree lesson

HTTP Methods: GET and POST

Learning the two most common HTTP methods for retrieving data and submitting information.

HTTP Methods: GET and POST

What you'll learn: The two fundamental ways browsers talk to servers—fetching pages and sending information.

The Two Main Ways to Communicate

Remember the Request-Response Cycle? When your browser sends an HTTP request, it uses a method to tell the server what kind of action it wants to perform. Think of methods like verbs in a sentence—they describe what you're doing.

The two most common methods are GET and POST.

GET: Asking for Information

GET is like asking a librarian for a book. You're requesting something to view, but you're not changing anything on the shelf.

When you type a URL into your browser or click a link, you're making a GET request. The browser is saying: "Hey server, please get me this web page."

Example scenario:

  • You visit https://example.com/products
  • Your browser sends: GET /products HTTP/1.1
  • The server responds with the products page

GET requests can include extra information in the URL itself (like ?search=shoes&size=10), but they shouldn't be used to change data on the server.

POST: Sending Information

POST is like filling out a form at the library to request a new book. You're actively submitting information that will create or change something.

When you fill out a login form or submit a comment, you're making a POST request. The browser sends data inside the request (not visible in the URL) to the server.

Example scenario:

  • You submit a login form
  • Your browser sends: POST /login HTTP/1.1 (with username and password in the request body)
  • The server processes your credentials and responds

Key Takeaway: Use GET to retrieve/view information without changing anything, and POST to submit data that creates or modifies something on the server.