/
updateglobal.php
74 lines (28 loc) · 1.04 KB
/
updateglobal.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
<?php
//step1
$cSession = curl_init();
//step2
curl_setopt($cSession,CURLOPT_URL,"https://api.steemjs.com/get_dynamic_global_properties");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
//step3
$result=curl_exec($cSession);
//step4
curl_close($cSession);
// echo $result;
//step5
$resultArray = json_decode($result, true);
// print_r($resultArray);
$total_vesting_fund_steem = $resultArray["total_vesting_fund_steem"];
$total_vesting_fund_steem = preg_replace('/[^0-9.]+/', '', $total_vesting_fund_steem);
echo $total_vesting_fund_steem;
$total_vesting_shares=$resultArray["total_vesting_shares"];
$total_vesting_shares = preg_replace('/[^0-9.]+/', '', $total_vesting_shares);
echo $total_vesting_shares;
$myfile = fopen("global.txt", "w") or die("Unable to open file!");
$txt = "total_vesting_fund_steem: ".$total_vesting_fund_steem."\n";
fwrite($myfile, $txt);
$txt = "total_vesting_shares: ".$total_vesting_shares."\n";;
fwrite($myfile, $txt);
fclose($myfile);
?>