daneth1712 Posted January 27, 2010 Share Posted January 27, 2010 Hi guys, I just need some clarification regarding the limitations of $_GET. I understand that $_GET variables should be kept under 100 characters, but I am planning on using about 250 variables in a single url post and wanted to check before I started writing it that it is going to work. Each variable used will probably not exceed 50 charatcers at most, generally this will be around 15-20 characters each, but if I am planning on using over 200 $_GET variables in one url, is this going to cause any problems? I know its probably a better idea to use $_POST, but this is a much easier way for me to set this up using $_GET with the amount of variables that need to be used for this script. Thanks in advance for your help! Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/ Share on other sites More sharing options...
Daniel0 Posted January 27, 2010 Share Posted January 27, 2010 You're definitely doing something wrong if you need that many parameters! Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002548 Share on other sites More sharing options...
aebstract Posted January 27, 2010 Share Posted January 27, 2010 I don't think it would really be a "problem" off the bat, you may run in to security issues or something. I wouldn't recommend anything like that honestly, what is wrong with using post? Might want to take note of this too: Although the RFC doesn’t lay down any length-related guidelines, Internet Explorer – with its insistence on finding ways to make things difficult for us – enforces a maximum URL length of 2,048 characters. Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002549 Share on other sites More sharing options...
daneth1712 Posted January 27, 2010 Author Share Posted January 27, 2010 Hi guys, If you see this thread, this is basically what I am trying to do. I have killed myself trying to fix that script and get it to work, that I know from trying that, that I can get it to work with 2 'reconnections'. So I am now looking to include as many 'files' ... or '$_GET's as possible in those 2 connections. Yes I could use $_POST for this, but it will just take me alot longer to set this up and test it. I more need an answer at this stage on a way this can/could work. Any pointers are very much welcomed. Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002555 Share on other sites More sharing options...
aebstract Posted January 27, 2010 Share Posted January 27, 2010 You really haven't given us any information on what this "script" is suppose to be doing and what it is doing wrongly. How are we suppose to offer any sort of help? Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002559 Share on other sites More sharing options...
daneth1712 Posted January 27, 2010 Author Share Posted January 27, 2010 apologies I meant to post this link http://www.phpfreaks.com/forums/index.php/topic,285559.0.html The script is an update/ftp download script. I have users with an apache/php setup on their local PC's where I plan on having a script added there that will basically talk to a script on a webserver that lists a load of files to download (this is perfectly legal btw) and connects via ftp and $_GET's the list of files and then places them where they should be on their local PC's. apologies again for missing the link on teh previous post Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002568 Share on other sites More sharing options...
Daniel0 Posted January 27, 2010 Share Posted January 27, 2010 Pass an array using POST. Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002571 Share on other sites More sharing options...
daneth1712 Posted January 27, 2010 Author Share Posted January 27, 2010 Many thanks Daniel0 for your help... so do you mean it will work like this? On page that will be on webserver (which I can add the list of files and paths to be downloaded) to look like this... <?php $updateitems=array('test1/test1.txt','test1/test2.txt','test1/test3.txt','test1/test4.txt','test1/test5.txt'); //etc etc for all 200+ files echo '<form method="post" action="http://localhost:80/updatefileonelocalserver.php">'; //where to send it echo '<input type="hidden" name="items" value="$updateitems">'; //array of files? Is there not a limit on the amount that can be posted here? ?> Then on the page on the local system to have them received like this? <?php $receiveditem1=$_POST['items'][0]; $receiveditem2=$_POST['items'][1]; $receiveditem3=$_POST['items'][2]; $receiveditem4=$_POST['items'][3]; $receiveditem5=$_POST['items'][4]; ?> Or have I done this wrong? Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002590 Share on other sites More sharing options...
Daniel0 Posted January 27, 2010 Share Posted January 27, 2010 More like this if it's a form you want to use. <?php $updateitems=array('test1/test1.txt','test1/test2.txt','test1/test3.txt','test1/test4.txt','test1/test5.txt'); echo '<form method="post" action="http://localhost:80/updatefileonelocalserver.php">'; foreach ($updateitems as $item) { echo '<input type="hidden" name="items[]" value="' . $item . '">'; } // etc. echo '</form>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002594 Share on other sites More sharing options...
daneth1712 Posted January 27, 2010 Author Share Posted January 27, 2010 ok great, so the foreach will repeat the hidden field for each array? So will the page I added as an example work for getting the info with your script? And one last thing, is there any limitation to the amount of times/files that can be used? Also... do you know if there are any server or browser limitations by doing it this way? As I kept running into problems before with http timeouts, header issues Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002603 Share on other sites More sharing options...
teamatomic Posted January 27, 2010 Share Posted January 27, 2010 The only limitation on gets AFAIK is domain.com?this|is|valid|here|as|a|url this is limited to 128 characters and before you reply back with a WTF, it is the first key in the GET array, empty, but useful if you want to be tricky about something. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/190024-_get-limitation/#findComment-1002669 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.