| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /wamp/www/bpkd_api/work/ |
Upload File : |
<?php
//fetch.php
$api_url = "http://localhost/bpkd_api/api/test_api.php?action=fetch_all_api";
$client = curl_init($api_url);
curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($client);
$result = json_decode($response);
$output = '';
$metodtag = '';
$tokentag = '';
$grouping = '';
$addgrouping = '';
$xrow=0;
$defhead='<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="5%">METODE</th>
<th width="40%">URL</th>
<th width="5%">TOKEN</th>
<th width="50%">DESCRIPTIONS</th>
<th width="0" hidden></th>
</tr>
</thead>
<tbody>';
$deffoot='
</tbody>
</table>
</div><br/>';
if(count($result)>0)
{
foreach($result as $row)
{
$xrow++;
if ($row->bidang==$grouping || $xrow=0){
$addgrouping='';
}else{
$addgrouping=$deffoot.'
<div class="w3-padding w3-large w3-teal w3-border">
<i class="fa fa-home"></i> '.
$row->bidang.'
</div><br/>'.$defhead;
}
switch ($row->metod){
case 'GET':
$metodtag = "<p><span class='w3-tag w3-orange'><b>".$row->metod."</b></span></p>";
break;
case 'POST':
$metodtag = "<p><span class='w3-tag w3-green'><b>".$row->metod."</b></span></p>";
break;
case 'PUT':
$metodtag = "<p><span class='w3-tag w3-blue'><b>".$row->metod."</b></span></p>";
break;
case 'DELETE':
$metodtag = "<p><span class='w3-tag w3-red'><b>".$row->metod."</b></span></p>";
break;
}
if($row->token_yn=='1'){
$tokentag = "<p><span class='w3-tag w3-green'><b>REQUEST/b></span></p>";
}else{
$tokentag = "<p><span class='w3-tag w3-light-gray'><b>NO</b></span></p>";
}
$output .= $addgrouping.
'<tr>
<td>'.$metodtag.'</td>
<td><a href='.$row->url.' target="_blank">'.$row->url.'</a></td>
<td align="center">'.$tokentag.'</td>
<td>'.$row->uraian.'</td>
<td hidden>'.$row->bidang.'</td>
</tr>';
$grouping=$row->bidang;
}
}
else
{
$output .= $defhead.'
<tr>
<td colspan="4" align="center">No Data Found</td>
</tr>'.$deffoot;
}
echo $output.$deffoot;
?>