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

3 Answers 3

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

4
  • Would I be better to send the AJAX request using post variables? I would assume those can be over 2000 characters
    – Spencer D
    Oct 2, 2013 at 3:08
  • yes if you have largeSet of values needed to pass on abd it would be much more reliable also Oct 2, 2013 at 3:10
  • heres a link you can decide whats more suitable for you to use dpends on your environment :stackoverflow.com/questions/715335/get-vs-post-in-ajax Oct 2, 2013 at 3:12
  • I take that back, according to 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 2, 2013 at 3:15
0

Max URL length is around 2000 charactors

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.