Welcome back to the Knowledge Portal Video series.
Today we are going to talk about one more Http method called as Post.
In order to understand post, let's take a simple example of a login form.
So this is a simple login form.
We all have gone across a login form when we used to enter a username and password and it can either
allow us to login or it will say incorrect password.
Now during these cases.
So during let's say you open gmail.com and it asks you for a username and password.
So essentially here you have to post some data to the application and click on sign in.
Application will verify whether the username and password that you have entered are correct or not and
depending upon that it will either give you access or it will not give you access.
So in this time, what essentially you are doing is you are posting some data to the application that
is running on the web server.
And during this time is when you use the Http post method because get won't work here.
In a nutshell, a Http post is used to send some data to the server to be processed in some way.
In this example we are posting or we are sending username and password to the application so that the
application can process it.
By process I mean validate whether a username and password are correct.
If we take a look at the example of a login form here instead of get we have post method on login dot
PHP and in the body section we have user is equal to admin and password is equal to test one two, three.
And this is one of the reasons why the http post method is used.
Now let's go to our lab section and see on how post is generally used.
What I'll do is.
Let's open Wireshark and start our packet capture.
I click on Start and go to Mozilla and let's open a simple login form.
Login.html.
And here it is asking for a username and password.
So username and password.
I'll put my password and when I click on login over here it will log me in.
So what essentially we are doing is we are posting our username and password to this particular web
application which will validate it and.
It will either allow us or it will not allow us.
So I'll click on login over here.
And here you see it has allowed us inside.
Now let's look at the Wireshark packet capture and see what has happened behind the scenes.
I'll filter based on Http.
It will be much more simpler.
Initially.
What has happened is our browser has sent a get request to the login.html.
On the web server and the server responded back with the login form.
So this essentially is the login form.
I'll close this.
And now after we have entered the username and password.
The request became post.
So let me filter back to Http.
And if we see over here, there is a post request.
So if I follow the TCP stream now after we enter the username and password, the request essentially
became a post.
And also here you see login is equal to zero and password is equal to password.
So my password was password in plain text and this is the login button.
The server will validate it and it will either allow us or either it will not allow us.
Now this essentially becomes a post request because in the body itself we are giving the username and
password and sending it back to the server.
And this is one of the reasons why the Http post method is used.
So essentially if you see.
Or if you think on where post can be used, then there are endless number of possibilities where http
post is used.
Take for example google.com where you have a search bar and where you enter whatever you want to search
and you click on Google Search and Google will present with you all the results.
So during that time, also essentially the Http post is used because you are posting some data to the
Google application.
This is it about the simple http post.
Request.
I'll suggest you to try this practical.
Also follow the labs that I have given and try to do a wireshark packet capture also.
This is it.
About this lecture.
I hope this has been informative for you and I'd like to thank you for viewing.