-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
64 lines (48 loc) · 1.3 KB
/
script.js
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
// Create a request variable and assign a new XMLHttpRequest object to it.
var request1 = new XMLHttpRequest()
var request2 = new XMLHttpRequest()
function request(url) {
const req = new XMLHttpRequest();
req.open('GET', url, false);
req.send(null);
if (req.status === 200) {
return req.responseText;
} else {
console.log(req.status + " : " + req.statusText);
return -1;
}
}
function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < millis);
}
function getStats()
{
console.log("Lancemet du script ...")
for (var i = 1; i < 1000; i++)
{
getHashTx(i);
}
}
function getHashTx(id)
{
console.log("On recupere les hash des tx : " + id)
var result = request("https://cors.io/?https://www.coinexplorer.net/api/v1/PPC/block?height="+id)
var txList = JSON.parse(result)
pausecomp(1001)
for (var i = 0; i < txList.result.tx.length; i++)
{
getTxInfo(txList.result.tx[i])
pausecomp(1001)
}
}
function getTxInfo(hash)
{
console.log("On recupere les infos des tx : " + hash)
var info = request("https://cors.io/?https://www.coinexplorer.net/api/v1/PPC/transaction?txid="+hash)
console.log(info)
}
getStats()