What is difference between get and post method in php


What is HTTP?

The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers. HTTP works as a request-response protocol between a client and server.

Two HTTP Request Methods commonly used for request-response between a client and server: GET and POST

The GET Method
Following example which shows you how to use get method.
http://www.example.com/test/demo_form.php?name1=value1&name2=value2

Following are GET Request Method Points.

1. Request can be cached
2. Requests can be bookmarked
3. Requests remain in the browser history
4. Requests have length restrictions
5. Requests should be used only to retrieve data
6. Requests should never be used when dealing with sensitive data
7. Maximum path length of 2,048 characters
8. Data visible to everyone in URL.
9. GET is less secure compared to POST because data sent is the URL.

Following are POST Request Method Points.

1. Requests are never cached
2. Requests do not remain in the browser history
3. Requests cannot be bookmarked
4. No restriction data lenght
5. Requests have no restrictions on data length
6. Data is not display in URL.
7. POST is a little safer than GET because the parameters are not stored in browser history.



We just started this developer diary for a beginner programmer to find a technical solution which we went through with our experience. If anyone to be a part of this please feel free share with us your problem with solutions. So we can share with more needed coder.

Most Popular

Connect to Amazon EC2 instance using Filezilla and SFTP

About PHP language & CodeIgniter

Reset the auto increment value for a MySQL table