Difference B/w Get and Post
----------------------------
1. GET is by default method form tag
1. POST is Strict method of form tag
2. GET is insecure method
2. POST is secure method
3. GET result in the generation of QueryString
3. POST doesnot generates QueryString hence the data is sent in Encoded Standard
and data remain hidden
Exp:
Any string in Url followed by ? as key and value pair seperated by & is called
is called QueryString
in GET Request : ? = 1 or more ???...
Mulitple Query String are used in framework
Rather in Post ? = 0
name: ______
gender:______
email:_______
------------------------------------------------
output.php?|name=awnish&gender=male&email=awnish@gmail.com |
|___|key__|value_________|seperator_______________|
| |
Query Mark Query String
4. in Get request only limited amount data can be sent to the server
4. but in post request more than 1024 character can be supplied
5. In Get Request File cannot be uploaded
5. In Post Request Any file can be uploaded infact a Movie of 5Gb
But Server Must Allow in Apache server Max_upload_limit=2MB
php.ini
enctype=multipart/form-data is important to be used with post method in case of
file Uploading
enctype=xwww-urlencode/data2.1
Explanation : when ever a data is sent to the server
1. url
2. header
content-type:application/json
https_client: off
ssl_peer_verify:true
...
...
...
cache-expiry:100Ms
Pragma:
We Modify Header for donwloading Image
header("Content-Type:application/Raw-data");
3. body
|formdata
|formencoded data
|raw data json data
-->How to sent data in json format
-->data:json
-->content-type:application/json
-->Encoding: UTF-8
{
"name":"awnish",
"gender":"male", "file":"askjqwgxebqwgegxhbshdgasjdgasgdjasghdbhasbhdbashdajsbvdvasdvasjvdjasvdjasvjdvasjdvjasvdasvdjjvwqyjdvwq=="
}
6. GET Request are cachable
6. POST Request are not cachable
How many Types of Storage are there in Your Browser
1. session storage
2. cache Storage
3. Local Storage
4. Web Storage
Ctrl+shift+I >> Application Layer
Hard Refresh and Clear Cache :
ctrl+shift+I Right Click On Reload Emtpy Cache Only For Chrome
<link href="mycss.css?version=1.1">
<link href="mycss.css?version=<?php echo time();?>">
google.com / username=jkakjabd and pass=1234
7. Get request can be BookMarked
7. Post Request cannot be BookMarked
API Level:
8. GET Request do not have any additional Security
can be publically Access
8. POST Request some Token has to be supplied and this token is called
CSRF Security.
CSRF : Cross site Request Forgery
csrf : prevention has to be done in case post request only
not recommended incase Ajax Request.
Server recived the data
Request Handling in PHP
-------------------------
here we response according to legal request only
and Request can be found using $_SERVER['REQUEST_METHOD']
Types of Request:
HTTP REQUEST METHOD
Get
post
Put
patch
delete
options
lock
head
...
...
0 Comments