Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit on Character Length $_GET?

Tags:

php

get

I have a variable which consists of

  // The First Page (hello.php)

 $a = 'goto.php?a_56=63525588000&url=http://www.example.com/site/DISC+cUSTOMc+Studio+24+-               +Windows/1142766.p?
       id=1218224802931&usi=1142766&cmp=RMX&
       ky=2crslw0k9ZOM0ciu2rqi4NsYY7eQnnEyP';

 // The Second Page (goto.php)
 $r = $_GET['url'];

 echo $r; 

//http://www.example.com/site/Disc cCustomc Studio 8 - Windows/1142766.p?id=1218224802931

Why is it getting cut off?

like image 511
Ryan Avatar asked Mar 21 '26 16:03

Ryan


1 Answers

This isn't a length issue, it's because you want one of your GET parameters (url in this case) to contain the & character. You need to urlencode this character otherwise it will be interpreted as another GET parameter in the request, rather than as part of the url parameter.

When urlencoding, & will become %26 and your query string will become this,

goto.php?a_56=63525588000&url=http://www.example.com/site/DISC+cUSTOMc+Studio+24+-+Windows/1142766.p?id=1218224802931%26usi=1142766%26cmp=RMX%26ky=2crslw0k9ZOM0ciu2rqi4NsYY7eQnnEyP
like image 102
Rich Adams Avatar answered Mar 23 '26 04:03

Rich Adams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!