I am trying to call webservice APi and display the result of that in our web page. i am trying below code, but its not fetching the status :
<table class="tbl-qa" border="1">
<thead>
<tr>
<th class="table-header">ID</th>
<th class="table-header">ORDERID</th>
<th class="table-header">Status</th>
</tr>
</thead>
<tbody id="table-body">
<?php
$tabindex = 1;
if (!empty($orderrecords))
{
foreach($orderrecords as $k => $v)
{
?>
<?php
$hide = '';
$data['username'] = '';
$data['password'] = '';
$data['awb'] = '890927143';
$url = 'https://plapi.ecomexpress.in/track_me/api/mawbd/?awb=awbnumber&order=' . $orderrecords[$k]["order_id"] . '&username=admin&password=admin123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
$res = explode("\n", $output);
if (!isset($res[13]))
{
$res[13] = null;
}
$status = $res[13];
?>
<tr value="" <?php
echo $hide; ?> class="table-row" id="table-row-<?php
echo $orderrecords[$k]["id"]; ?>" tabindex="<?php
echo $tabindex; ?>">
<td><input type="checkbox" onclick="assignorderids('<?php
echo $orderrecords[$k]["order_id"]; ?>')" name="assigneeid" id="assigneeid-<?php
echo $orderrecords[$k]["order_id"]; ?>" value="<?php
echo $orderrecords[$k]["order_id"]; ?>"></td>
<td>
<?php
echo $orderrecords[$k]["order_id"]; ?>
</td>
<td><?php
echo $status; ?></td>
</tr>
<?php
$tabindex++;
}
} ?>
</tbody>
</table>
Please let me know if you need more information. I am using php mysqli....
I am trying in localhost.... is i need to try in server to make it work?