json_decode() not working on the web server
json, magic-quotes-gpc, php
Solution
I had to do this to make `json_decode` work. Maybe there is a better scheme for this.
$j = $_POST["json"];
$j = str_replace("\\\\\"", "###dq###", $j);
$j = str_replace("\\", "", $j);
$j = str_replace("###dq###", "\\\"", $j);
or, in short:
$j = stripslashes($j);
Problem
I have a php script which is working perfectly on my localhost server. When I moved everything from the localhost to the web server my `json_decode` is not working. I have tried `json_encode` and still nothing. what could be a problem for such behavior? my code: `$productsArr = json_encode($_GET['object']);` `$_GET['object']` is validated JSON. My last option could be `magic_quotes` but I don't know if I can change PHP.ini file using a cPanel which is my only access to the server. I would appreciate any ideas. EDIT: this is part of my url: ``` Request URL:http://something.com/download.php?object=[{%22code%22:%222F-58S%22},{%22code%22:%22HT-45H%22},{%22code%22:%2244-3%22},{%22code%22:%22898-OPv%22}]&checkbox= ``` I'm using this headers if this is even important: ``` header('Content-Description: File Transfer'); header("Content-type: application/ms-word"); header("Content-Disposition: attachment;Filename=$name_of_file.doc"); ```