I completely lost this problem.
I have an ajax request that receives a json response. The request works fine in most situations, however it seems to stumble when the json response is very large.
The problem is that the answer ends in the form:
...est":"test length"}]]}
HTTP/1.1 200 OK
Date: Wed, 21 Sep 2011 17:10:32 GMT
Server: Apache/2.2.11 (Win32) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0
X-Powered-By: PHP/5.3.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Keep-Alive: timeout=5, max=90
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
5b03d
{"ResultsInfo":{"RequestID":"131661886010","FeedCompletion":{"0":"100"}},"ResultsData":[[{"test":"test length"},{"test":"test length"},
...0
... are more of the same "{" test ":" test length "}," string
Thus, the answer is presented in the form:
- Last piece of data
- Http response header printed in body
- Symbols '5b03d'
- First piece of data
- Character '0'
THERE IS NO EXTRACT answer length that this is happening, but it’s normal on 360791 characters, but not 372797 characters.
Yii PHP, .
, - - .
?
_ ____________________________________
/json, , . Tes , , ( applciaiton/json):
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2011 08:48:28 GMT
Server: Apache/2.2.11 (Win32) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0
X-Powered-By: PHP/5.3.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Keep-Alive: timeout=5, max=89
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json
script?
** 2_ ________________________________
, , , :
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2011 11:55:39 GMT
Server: Apache/2.2.11 (Win32) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0
X-Powered-By: PHP/5.3.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 372797
Keep-Alive: timeout=5, max=90
Connection: Keep-Alive
Content-Type: application/json
, , chunked. - , , .
** , "5b03d" "0".
EDIT_3_ __________________________
, php-
$dataArray = array(
'ResultsData'=>array(
array('test'=>'test length'),
array('test'=>'test length'),
array('test'=>'test length'),
...
));
$return = json_encode($dataArray);
header('Content-Length: '.strlen($return));
header('Content-type: application/json');
echo $return;