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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -