I'm passing a fairly large (but not huge) Json object using ajax, and writing it to a file using PHP. The $.post command works fine, but the data in the file is truncated (though still in perfect JSON formatting.
I can't figure out why.
Here's the JavaScript command. "output" is a javascript objects that contains arrays within arrays.
function saveWerJSON (output) {
console.log(output);
$.post("writefile.php", output, function(output){ console.log("yes"); });
};
Here's the PHP file in its entirety
<?php
file_put_contents("wer1861.json", json_encode($_POST, JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT));
?>
the file cuts off after 1422 lines (length: 40300). The problem is not with the encoding, I don't think, but with the length. Because if I change the order of the variables it cuts off in a different place--but at the same length.
I should add that the json in the file is valid. So it's the variable that's getting truncated. Not the file itself.
Any ideas?