i have this api with a lot of campaigns, i need to get to show specific campaigns from the last month like the name of the campaign, and the status, but i cannot figure it o ut how to do so..
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Campaign Exclude App</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<h1>Campaigns</h1><br>
<input type="text" name="" id="">
<input type="submit">
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">Id</th>
<th scope="col">Campaign Name</th>
<th scope="col">CPA Goal</th>
<th scope="col">Click Amount</th>
</tr>
</thead>
</table>
<?php
$url='https://www.popads.net/api/campaign_list?key=9a790b65025e0aa449e60384a87b56e97c3ebf39';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
$resultArray = json_decode($result);
echo "<pre>";
print_r($resultArray);
?>
</body>
</html>
To list records within the last 30 days, you can filter the curl response as below
<?php
$url = 'https://www.popads.net/api/campaign_list?key=9a790b65025e0aa449e60384a87b56e97c3ebf39';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
$resultArray = json_decode($result, true);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Campaign Exclude App</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<h1>Campaigns</h1><br>
<input type="text" name="" id="">
<input type="submit">
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">Id</th>
<th scope="col">Campaign Name</th>
<th scope="col">CPA Goal</th>
<th scope="col">Click Amount</th>
</tr>
<?php
$today = date('Y-m-d h:i:s');
$lastmonth = date('Y-m-d h:i:s', strtotime('-1 months', strtotime($today)));
foreach ($resultArray['campaigns'] as $campaign) {
if ($campaign['created'] > $lastmonth) {
?>
<tr>
<td scope="col"><?php echo $campaign['id']; ?> </td>
<td scope="col"><?php echo $campaign['name']; ?></td>
<td scope="col"><?php echo $campaign['xxxxxxx']; ?></td>
<td scope="col"><?php echo $campaign['xxxxxxx']; ?></td>
</tr>
<?php }
} ?>
</thead>
</table>
</body>
</html>