-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathoperators.php
More file actions
48 lines (41 loc) · 1.5 KB
/
operators.php
File metadata and controls
48 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
include_once 'layout/head.php';
include_once 'layout/header.php';
include_once 'endpoints/getToken.php';
$ch = curl_init();
$page = isset($_GET['page'])?$_GET['page']:1;
curl_setopt($ch, CURLOPT_URL, "https://topups.reloadly.com/operators?page=$page");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type:application/json",
"Authorization: Bearer ".$tokenResponse->access_token
));
$response = curl_exec($ch);
curl_close($ch);
$operatorsResponse = json_decode($response);
?>
<main role="main" class="flex-shrink-0">
<div class="container pt-5 mt-5">
<div class="col text-center mb-4">
<h1>Operators</h1>
</div>
<div class="col">
<div class="row">
<?php foreach($operatorsResponse->content as $operator) { ?>
<a href="operator.php?id=<?=$operator->operatorId?>" class="col-4"><?=$operator->name?> [ <?=$operator->destinationCurrencyCode?> ]</a>
<? } ?>
</div>
<div class="row mt-3 justify-content-center">
<?php for($x =1; $x <= $operatorsResponse->totalPages; $x++) { ?>
<div class="col-auto pr-0">
<a href="operators.php?page=<?=$x?>" class="btn btn-sm btn-primary"><?=$x?></a>
</div>
<?php } ?>
</div>
</div>
</div>
</main>
<?php
include_once 'layout/footer.php';
?>