php - Multiple Json response to html Table format -
i want fetch data different servers database , need shown in 1 centralised server. have written select query in different locations , trying fetch in 1 centralised server. i getting json array response.
but tried displaying in html table format, unable proper result.
here centralised server php code:
<?php $arr = array ( 'http://example.com/pristatus/send-curl.php', 'http://example2.com/pristatus/send-curl.php' ); ($i =0; $i<count($arr); $i++) { $ch = curl_init(); curl_setopt($ch, curlopt_url, $arr[$i]); curl_setopt($ch, curlopt_returntransfer, 1); $output = curl_exec($ch); if($output!="error"){ $data = json_decode($output); } echo "<pre>"; print_r($data); curl_close($ch); } ?>
output getting:
array ( [0] => stdclass object ( [id] => 9 [status] => ok [batch] => 119677 [location] => hyderabad [createddt] => 2015-06-19 20:40:05 ) ) array ( [0] => stdclass object ( [id] => 1 [status] => ok [batch] => 56339 [location] => mumbai [createddt] => 2015-06-19 20:40:05 ) [1] => stdclass object ( [id] => 2 [status] => ok [batch] => 56339 [location] => mumbai [createddt] => 2015-06-19 20:40:05 ) )
please suggest me how can display json response in table format.
you need use foreach loop , value like
foreach($array $val) $val->property
Comments
Post a Comment