-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.php
36 lines (32 loc) · 1.03 KB
/
index.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
<meta name="viewport" content="width=device-width",initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://www.w3schools.com/w3css/4/w3.css">
<br>
<h3 class="w3-container w3-center">Token Holders Info</h3>
<table class='w3-table-all'><tr class='w3-blue w3-hover-red'><th>S/N</th><th>Address</th><th>Balance</th></tr>
<?php
function fetch_content($url){
curl_setopt($ch=curl_init(), CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
$sn = 0;
$tokenAddress = "0x";
//number of pages
$numpage = 5;
for($i = 1;$i <= $numpage;$i++){
$url = "https://ethplorer.io/service/service.php?data=".$tokenAddress."&page=tab%3Dtab-holders%26pageSize%3D100%26holders%3D".$i;
$array = array(json_decode(fetch_content($url), true));
foreach($array as $data) {
foreach($data['holders'] as $eth) {
echo "<tr>";
echo "<td>".++$sn. "</td>";
echo "<td>".$eth['address']."</td>";
echo "<td>".$eth['balance']. "</td>";
echo "</tr>";
}
}
}
echo "</table>";
?>