-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisplay.php
135 lines (116 loc) · 4.55 KB
/
display.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
require "app/vendor/autoload.php";
use Codenixsv\CoinGeckoApi\CoinGeckoClient;
$client = new CoinGeckoClient();
// $data = $client->derivatives()->getExchanges();
// $data = $client->simple()->getPrice('0x,bitcoin', 'usd,rub');
// $data = $client->coins()->getList();
$data = $result = $client->coins()->getMarkets('usd');
$response = $client->getLastResponse();
$headers = $response->getHeaders();
// print_r($data['0']['name']);
?>
<br />
<br />
<br />
<br />
<div class="container" id="priceyy">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Price(USD)</th>
<th scope="col">Change(24h)</th>
<th scope="col">Trade</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i <= 5; $i++) {
$res = $data[$i];
?>
<tr>
<th scope="row">
<img src="<?php echo $res['image']; ?>" alt="btc" srcset="" width="40px" height="40px" />
<label class="display" for=""><?php echo $res['name']; ?></label>
</th>
<td>
<label class="display" id="btcprice">$ <?php echo $res['current_price']; ?> </label>
</td>
<td>
<label class="display" id="btcperc"><?php echo $res['price_change_percentage_24h']; ?></label>
</td>
<td>
<button class="w3-button w3-border w3-light-blue w3-round-large w3-hover-blue"
id="register">Buy</button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<p>
<!-- <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false"
aria-controls="collapseExample">
</a> -->
<center>
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample"
aria-expanded="false" aria-controls="collapseExample">
More Coin
</button>
</center>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Price(USD)</th>
<th scope="col">Change(24h)</th>
<th scope="col">Trade</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i <= 50; $i++) {
$res = $data[$i];
?>
<tr>
<th scope="row">
<img src="<?php echo $res['image']; ?>" alt="btc" srcset="" width="40px" height="40px" />
<label class="display" for=""><?php echo $res['name']; ?></label>
</th>
<td>
<label class="display" id="btcprice"> $ <?php echo $res['current_price']; ?> </label>
</td>
<td>
<label class="display"
id="btcperc"><?php echo $res['price_change_percentage_24h']; ?></label>
</td>
<td>
<button class="w3-button w3-border w3-light-blue w3-round-large w3-hover-blue"
id="register">Buy</button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
<br>
<br>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous">
</script> -->
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
-->
</html>