Implementing an AJAX feed data to a PHP script, and usually by sending data via GET, it had not experienced major problems, however this time the number of bytes far exceed the limited capacity of the GET. Before proceeding further, to clarify this point that we have reference …
Do limit the number of characters that can be passed by GET ($ _GET)?
In mid-1998 was published the HTTP protocol specification, a fairly complete, but inaccurate in the ceiling of the data transferred via GET, so long after the browsers by themselves have released their own specifications .
We emphasize the limits of the most popular:
- Internet Explorer: 2.083 caracteres
- FireFox: 65.536 caracteres
- Safari: 80.000 caracteres
- Opera: 190.000 caracteres
Thus
Depending on the same platform and web server, we must consider other standards, such as for example:
- Apache: 4.000 caracteres
- Microsoft Internet Information
Considering this could easily determine that the data above 2000 characters is preferable to pass POST.
Now, returning to the subject in which I lifted this morning, I commented that it is very common in the lives of professional development due to physical and mental fatigue, in many cases can last for hours solving one problem, otherwise we just take a few minutes.
In this case was no exception
The original code that sends data via GET as follows:
<span onmouseover=”_tipon(this)” onmouseout=”_tipoff()”><span style=”direction: ltr; text-align: left;”>xml.open(‘get’, ‘http://www.webnesbay.com/script.php?variable_get=hello’);</span> xml.open ( ‘get’, ‘http://www.webnesbay.com/script.php?variable_get=hello”);</span>
<span onmouseover=”_tipon(this)” onmouseout=”_tipoff()”><span style=”direction: ltr; text-align: left;”>xml.onreadystatechange = handleResults;</span> xml.onreadystatechange = handleResults;</span>
<span onmouseover=”_tipon(this)” onmouseout=”_tipoff()”><span style=”direction: ltr; text-align: left;”>xml.send(null);</span> xml.send (null);</span>
Now, so we can send data by POST, so we must add a header data, as I do below:
<span onmouseover=“_tipon(this)” onmouseout=“_tipoff()”><span class=“google-src-text” style=“direction: ltr; text-align: left;”>xml.open(‘post’, ‘http://www.webnesbay.com/script.php?variable_get=hola’);</span> xml.open ( ‘post’, ‘http://www.webnesbay.com/script.php?variable_get=hello’);</span>
<span onmouseover=“_tipon(this)” onmouseout=“_tipoff()”><span class=“google-src-text” style=“direction: ltr; text-align: left;”>xml.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded; charset=ISO-8859-1′);</span> xml.setRequestHeader ( ‘Content-Type’, ‘application / x-www-form-urlencoded; charset = ISO-8859-1′);</span>
<span onmouseover=“_tipon(this)” onmouseout=“_tipoff()”><span class=“google-src-text” style=“direction: ltr; text-align: left;”>xml.send(“variable_post=1&variable_post2=1″);</span> xml.send (variable_post = 1 & variable_post2 = 1 ”);</span>
The problem was that to send data by POST need to send a previously that allows us to store the contents.
Related posts:
- Decorators in Python
- Show which IP addresses are connected to my server
- Creating thumbnails in PHP using pear libraries
- Access files on the server via sql-injection in PostgreSQL
- Differences between df and du command in linux
- Prevent end-user to restart your linux computer
- Renaming multiple files simultaneously
- How to open your computer if you do not know your password
- Secrets of Sony Ericsson mobile phone
- How to send SMS using Google Voice

