I tried to extract > 30,000 records as JSON data , I cannot get the correct answer. But I tried the PHP Service directly to print JSON, it prints the actual record without any error. But in AngularJS, I cannot get the actual number of records.
My sample JSON data
{
"records":[
{
"ldat":"2014-08-13",
"eid":"HSL018",
"dr":"55420",
"cr":"0",
"bal":"55420"
},
{
"ldat":"2014-10-11",
"eid":"HBL056",
"dr":"0",
"cr":"35000",
"bal":"20420"
},
{
"ldat":"2014-10-26",
"eid":"HBL001",
"dr":"0",
"cr":"420",
"bal":"20000"
},
----- 30,000 Records -----
,
{
"ldat":"2015-11-01",
"eid":"HDL001",
"dr":"0",
"cr":"20000",
"bal":"0"
}
]
}
during debugging, I received only a partial output from the answer.
{
"records":[
{
"ldat":"2014-08-13",
"eid":"HSL018",
"dr":"55420",
"cr":"0",
"bal":"55420"
},
{
"ldat":"2014-10-11",
"eid":"HBL056",
"dr":"0",
"cr":"35000",
"bal":"20420"
},
{
"ldat":"2014-10-26",
"eid":"HBL001",
"dr":"0",
"cr":"420",
"bal":"20000"
},
----- 4,000 Records -----
,
{
"ldat":"2015-11-01",
"eid":"HDL0
Do you know if there are any restrictions in Response
? How to get the whole record as an answer? Please help me...
Response Header Details I Received
HTTP/1.1 200 OK
Date: Thu, 11 Feb 2016 01:31:45 GMT
Server: Apache
Access-Control-Allow-Origin: *
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
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=10, max=500
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=UTF-8
My php service script
<?php
ob_start();
ob_start("ob_gzhandler");
echo $content;
ob_end_flush();
$gzippedContent = ob_get_contents();
header('Content-Length: '.strlen($gzippedContent));
ob_end_flush();
?>
Use the following PHP Script to test the task; it will create 35,000 entries .
PHP : Statement.php
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
$content = "";
for($i=1; $i<=35000; $i++) {
if ($content != "") {
$content .= ",";
}
$content .= '{"slr":' . $i . ',';
$content .= '"uid":' . rand(100,10000) . ',';
$content .= '"name":"Balamanigandan",';
$content .= '"cell":"9999999999",';
$content .= '"balance":10000,';
$content .= '"ltrans":"2015-01-01",';
$content .= '"msg":" Opening Balance"}';
}
$content = '{"records":[' . $content . ']}';
ob_start();
ob_start("ob_gzhandler");
echo $content;
ob_end_flush();
$gzippedContent = ob_get_contents();
header('Content-Length: '.strlen($gzippedContent));
ob_end_flush();
?>
AngularJS Script
var stmt= angular.module('Statement', []);
stmt.controller('StmtCtrl', function($scope, $http, $cacheFactory) {
var request = $http({
method: "post",
url: "Statement.php",
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
});
request.success(function (response)
{
$scope.data = response;
});
});
. , .