I am getting the huge json data from the webservice and parsing through loop.but loop makes my website slow.Is there any other ways to fetch the json data in php?. This is my snippet.
for ($i=0; $i < count($trid) ; $i++) {
$operator_aval=operator_routes_a($trid[$i],$Fromd);
$page1=file_get_contents($operator_aval);
$data1=json_decode($page1,true);
$opr_res=count($data1['routes']);
for ($j=0; $j < count($data1['routes']); $j++) {
$origin=$data1['routes'][$j]['route']['origin'];
$destination=$data1['routes'][$j]['route']['destination'];
$status=$data1['routes'][$j]['route']['status'];
$service_name=$data1['routes'][$j]['route']['operator_service_name'];
// echo $origin."--".$destination."<br>";
if(($Fromname==$origin) && ($Toname==$destination) &&($status!="Unavailable-Service Left" || $status!="Unavailable-Cancelled")&& $service_name!=""){
echo 'trid : '.$trid[$i].'reservation id : '.$data1['routes'][$j]['route']['reservation_id']."---".$data1['routes'][$j]['route']['travels']."<br>";
$count++;
}
}
}