0

I am developing a application that sends in jquery a parameter via URL like this:

json = JSON.stringify(chk);
base64 = Base64.encode(json);
location = '?route=home/debts/insert&json='+base64;

where chk is type array.

Then in the target page I am decoding it in PHP with:

$chk = json_decode(base64_decode($_REQUEST['json']));

On local server this works miracle, but when into live system, on the server, I can't get the URL parameter, actually the $_GET['json'] or $_REQUEST['json'] are blank, even if I can see them in the URL format

Could someone give me a hint about what am I wrong?

EDIT:

The var_dump($_GET) fired: array(1) { ["route"]=> string(17) "home/debts/insert" }

rosuandreimihai
  • 656
  • 3
  • 16
  • 39

2 Answers2

0

Can you update the location variable as below (I have inserted a / after insert) and try?

location = '?route=home/debts/insert/&json='+base64;

I have faced a similar issue, where I used Apache in my local machine and IIS on the server. IIS had a config issue and it was not able to handle the URL without the /.

infernal_lad
  • 425
  • 1
  • 7
  • 13
0

You should URL encode all parameters. You can add URL encoding to the base64 data by adding the following: base64 = encodeURIComponent(base64);

You should also think about URL encoding route=home/debts/insert as route=home%2Fdebts%2Finsert

Maury
  • 610
  • 5
  • 7