If you are looking to get the that relates to a Ledger (Block) on the CSCL use the following script
<?php
$daemon = 'http://xxxxxxxxxxx:8443';
function getLedger($index, $daemon) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $daemon);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '
{ "method" : "ledger",
"params" :
[ {"ledger_index": '.$index.',"transactions": true}
] }
');
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
if (empty($result)) {
throw new Exception("Content is empty.");
}
$obj = json_decode($result, 1);
if (empty($obj)) {
throw new Exception("JSON decode failed, content: " .$result);
}
return $obj;
}
$ledgerArray = getLedger(172234, $daemon);
var_dump($ledgerArray);
?>
This will give the output of
array(1) {
["result"]=>
array(5) {
["ledger"]=>
array(17) {
["accepted"]=>
bool(true)
["account_hash"]=>
string(64) "3609A9D1AC6D6137F8CE7A65E67D4032D0AF6204A85B2ACDB164F37C7CBD6529"
["close_flags"]=>
int(0)
["close_time"]=>
int(633110120)
["close_time_human"]=>
string(20) "2020-Jan-23 15:55:20"
["close_time_resolution"]=>
int(10)
["closed"]=>
bool(true)
["hash"]=>
string(64) "F1F1132376CA09E1FDE281C5B03234F2517C9A7C2E360F292B77F8337F9E4ADA"
["ledger_hash"]=>
string(64) "F1F1132376CA09E1FDE281C5B03234F2517C9A7C2E360F292B77F8337F9E4ADA"
["ledger_index"]=>
string(6) "172234"
["parent_close_time"]=>
int(633110112)
["parent_hash"]=>
string(64) "207C1D118F0F6AAE909302798A7FB7F00FBE1BF372D59F9841FA33524A0DDEDA"
["seqNum"]=>
string(6) "172234"
["totalCoins"]=>
string(19) "3999999992024999979"
["total_coins"]=>
string(19) "3999999992024999979"
["transaction_hash"]=>
string(64) "E5818E0D2DC182E67F894E7D283BCE314024BCD8A8863207ECC9566DC1B8D7D9"
["transactions"]=>
array(1) {
[0]=>
string(64) "0E79AD34FB547E9D356A71CD08B6CD960DCAA8CB8B07ED25388D003D86AAB68C"
}
}
["ledger_hash"]=>
string(64) "F1F1132376CA09E1FDE281C5B03234F2517C9A7C2E360F292B77F8337F9E4ADA"
["ledger_index"]=>
int(172234)
["status"]=>
string(7) "success"
["validated"]=>
bool(true)
}
}