I am basically making game statistics, game server reports to my php script, the script is supposed to log statistics and create db record.
Example report (valid json) http://pastebin.com/rugHavwt
My debugging part of script goes like this
function LogStuff($what){
global $currentErrors;
$what = "[".date("Y-m-d H:i:s")."]".$what;
$currentErrors .= $what . "\n";
}
LogStuff($_POST['stuff']);
$stuff = json_decode($_POST['stuff'],true);
LogStuff("1:".json_encode($stuff));
LogStuff("2:".json_encode($stuff['players']));
$playersOnServer = count(array_values($stuff['players']));
and now the problem comes, when i send the request manually via Postman, or when there are fewer players on the server - everything works fine http://pastebin.com/hwtGHutX
but when server sends the request, this happens
[2014-03-09 19:49:37]fine request, more here http://pastebin.com/DLrPrnS2
[2014-03-09 19:49:37]1:null
[2014-03-09 19:49:37]2:null
So to summarize, when same request is send manually json_encode works just fine but when same request is send by game server, json_encode returns null. I wonder what might cause this...