繁体   English   中英

添加Web API搜索过滤器

[英]Adding Web API Search filter

我想通过API请求为表格上方的日期和子ID添加两个搜索者

这是我的PHP代码

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<?php
$xml = new SimpleXMLElement('https://partners.sites.com/affiliates/api/1/reports.asmx/Conversions?api_key=aaaaaaaaa&%20affiliate_id=11111&start_date=06/01/2019+00:00:00&end_date=06/31/2019+00:00:00&conversion_id=&subid_3&include_tests=false&start_at_row=1&row_limit=200'.$_GET["callsign"], 0, TRUE);
?>

<body>
<table class="outer">
 <table class="middle">
  <table class="inner">
  <thead>
    <tr>
      <th>DATE</th>
      <th>NAMA OFFER</th>
      <th>NEGARA</th>
      <th>PAYOUT</th>
      <th>USER</th>
    </tr>
  </thead>
  <tbody>

<?php foreach ($xml->conversions->conversion as $datanya) :?>
    <tr>
      <td><?php echo $datanya->conversion_date; ?></td>
      <td><?php echo $datanya->offer_name; ?></td>
      <td><?php echo $datanya->country; ?></td>
      <td><?php echo $datanya->price_usd; ?></td>
      <td><?php echo $datanya->subid_3; ?></td>
    </tr>
<?php endforeach; ?>
  </tbody>
   </table>
  </table>
 </table>
</table>
</body>
</html>

桌子

还有其他方法,例如过滤已成为表格的结果吗?

嗨,您可以使用https://datatables.net/examples/styling/bootstrap

搜索Api结果:

演示版

<!DOCTYPE html>
<html>
<head>

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css
">
</head>


<?php
$xml = new SimpleXMLElement('https://partners.sites.com/affiliates/api/1/reports.asmx/Conversions?api_key=aaaaaaaaa&%20affiliate_id=11111&start_date=06/01/2019+00:00:00&end_date=06/31/2019+00:00:00&conversion_id=&subid_3&include_tests=false&start_at_row=1&row_limit=200'.$_GET["callsign"], 0, TRUE);
?>

<table id="example" class="table table-striped table-bordered" style="width:100%">
        <thead>
    <tr>
      <th>DATE</th>
      <th>NAMA OFFER</th>
      <th>NEGARA</th>
      <th>PAYOUT</th>
      <th>USER</th>
    </tr>
  </thead>
  <tbody>

<?php foreach ($xml->conversions->conversion as $datanya) :?>
    <tr>
      <td><?php echo $datanya->conversion_date; ?></td>
      <td><?php echo $datanya->offer_name; ?></td>
      <td><?php echo $datanya->country; ?></td>
      <td><?php echo $datanya->price_usd; ?></td>
      <td><?php echo $datanya->subid_3; ?></td>
    </tr>
<?php endforeach; ?>
  </tbody>
   </table>
  </table>
 </table>
</table>
</body>
</html>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM