Home > headlines > body text

Analysis of the length of data transferred by GET and POST

小云云
Release: 2017-11-23 09:18:41
Original
2439 people have browsed it

When requesting and responding between the client and the server, the two most commonly used methods are: GET and POST. GET - Request data from the specified resource, POST - Submit the data to be processed to the specified resource. In this article, we will analyze the maximum length of data transmitted by GET and POST.

In various web development languages, data is basically transferred between each page. The more commonly used data transfer methods in web development are get post. Until now, I have only known that the amount of data transferred by get is larger than The amount of data transferred by post is smaller, so you still need to use post to transfer large amounts of data. But how much data can the maximum amount of data transferred by get post be? Never figured it out.

Due to the needs of work today, I have to clarify this issue. Let’s talk about the maximum length of data transmitted by GET and POST.

get submits data through the URL, so the amount of data that can be submitted by GET is directly related to the maximum length that the URL can achieve. Many articles say that the data submitted through GET can only be up to 1024 bytes. In fact, there is no upper parameter limit for URLs, and the HTTP protocol specification does not limit the URL length. This limit is imposed by specific browsers and servers. IE's limit on URL length is 2083 bytes (2K+35 bytes). For other browsers, such as FireFox, Netscape, etc., there is no length limit. At this time, the limit depends on the server's operating system. That is, if the URL is too long, the server may reject the request or make an incomplete data request due to security settings.

Theoretically speaking, there is no size limit for post, and the HTTP protocol specification does not impose a size limit. However, in fact, the amount of data that post can transmit depends on the server settings and memory size. Because the data volume of our posts rarely exceeds MB, we rarely feel the limit of the data volume of posts. However, in practice, if you upload files, you may find such a problem, that is, uploading relatively large files. When the file is sent to the server, it may not be uploaded. In PHP language, when checking the reason, you may see that there are parameters related to PHP uploading files. PHP has a limit on uploading by default. Generally, this value is 2MB. Change this value. You need to change the value of post_max_size in php.conf. This clearly illustrates the problem.

Through the brief introduction of the above article, we have a clear understanding of the maximum length of data transmitted by GET and POST. I hope it can help everyone.

Related recommendations:

curl get post request usage example sharing in php

curl get post request analysis in php

How to use native JS to implement Ajax GET POST request

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template