1

I was wondering if there is a max length on a $_GET variable. I plan on using ajax with a get command and part of it is an encoding of an access key using one of my encoding methods. This method has returned back roughly 1530 characters and I was wondering if this it too long for a get variable as long as it's all URL encoded? Thanks in advance, Spencer

Spencer D
  • 3,376
  • 2
  • 27
  • 43

3 Answers3

3

Browser would greatly affect the max length of your $_GET param

MAXIMUM LENGTH FOR BROWSERS REFERENCE

Some versions of PHP have a limitation of length of GET params:

PHP.NET REFERENCE

Community
  • 1
  • 1
Jhonathan H.
  • 2,734
  • 1
  • 19
  • 28
  • Would I be better to send the AJAX request using post variables? I would assume those can be over 2000 characters – Spencer D Oct 02 '13 at 03:08
  • yes if you have largeSet of values needed to pass on abd it would be much more reliable also – Jhonathan H. Oct 02 '13 at 03:10
  • heres a link you can decide whats more suitable for you to use dpends on your environment :http://stackoverflow.com/questions/715335/get-vs-post-in-ajax – Jhonathan H. Oct 02 '13 at 03:12
  • I take that back, according to http://support.microsoft.com/kb/208427, in ie at least, the max length for a post variable is also 2,048 characters. Anyways, I'll check into that link. Thanks for the help. – Spencer D Oct 02 '13 at 03:15
0

Max URL length is around 2000 charactors

In IE is around 2048 - http://support.microsoft.com/kb/208427

Chokchai
  • 1,684
  • 12
  • 12
0

Similar to this? https://stackoverflow.com/a/7725515/2827152

Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.

To add support for long parameters with suhosin, add suhosin.get.max_value_length = in php.ini

Source: http://www.php.net/manual/en/reserved.variables.get.php#101469

Community
  • 1
  • 1
Will
  • 2,343
  • 1
  • 14
  • 14