Get List of Tokens on CSCL

To retrieve an array of tokens available on the CSCL use the following script

<?php

$daemon = 'http://xxxxxxxxxx:8443';

function tokens($daemon) {

$ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $daemon);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, '

       { "method" : "config_info", 
			"params" : 
			[ 	{
				
				}
			] }

    ');
    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;
}

$get = tokens($daemon);

var_dump($get);


?>

This will give a response of


array(1) {
  ["result"]=>
  array(4) {
    ["configuration"]=>
    array(5) {
      [0]=>
      array(3) {
        ["ConfigData"]=>
        array(1) {
          [0]=>
          array(1) {
            ["account"]=>
            string(34) "chXKNwZUjRLxdUumHoWji6iAAs2YLPV5eY"
          }
        }
        ["ConfigID"]=>
        int(4)
        ["ConfigType"]=>
        string(16) "Blacklist_Signer"
      }
      [1]=>
      array(3) {
        ["ConfigData"]=>
        array(15) {
          [0]=>
          array(10) {
            ["apiEndpoint"]=>
            string(28) "https://api.100.com/endpoint"
            ["contactEmail"]=>
            string(12) "info@100.com"
            ["extraFeeFactor"]=>
            int(0)
            ["flags"]=>
            int(0)
            ["fullName"]=>
            string(7) "100.com"
            ["iconURL"]=>
            string(94) "https://raw.githubusercontent.com/casinocoin/CasinoCoin-Assets/master/v4/100-coin-icon-512.png"
            ["issuer"]=>
            string(34) "cEWTA66ypmFVzZksJntBetbeQdDqnRLA44"
            ["token"]=>
            string(3) "100"
            ["totalSupply"]=>
            string(12) "250000000000"
            ["website"]=>
            string(19) "https://www.100.com"
          }
          [1]=>
          array(10) {
            ["apiEndpoint"]=>
            string(25) "https://api.pokercoin.com"
            ["contactEmail"]=>
            string(18) "info@pokercoin.com"
            ["extraFeeFactor"]=>
            int(0)
            ["flags"]=>
            int(0)
            ["fullName"]=>
            string(9) "PokerCoin"
            ["iconURL"]=>
            string(96) "https://raw.githubusercontent.com/casinocoin/CasinoCoin-Assets/master/v4/poker-coin-icon-512.png"
            ["issuer"]=>
            string(34) "cfiikpLkuWH2rYK1b7fV7RziYVuqUY6koo"
            ["token"]=>
            string(3) "PCN"
            ["totalSupply"]=>
            string(10) "1000000000"
            ["website"]=>
            string(25) "https://www.pokercoin.com"
          }
        .............

Get Address (Account) on the CSCL

To retrieve information on an address use the following script

<?php

$daemon = 'http://xxxxxxxx:8443';

function getAccount($account,$daemon) {

$ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $daemon);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, '

       { "method" : "account_info", 
			"params" : 
			[ 	{
				"account": "'.$account.'",
				"strict": true,
				"ledger_index": "current",
				"queue": 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;
}

$account = getAccount('cnKwvH78cUTAvZbm8TWZXqdsWhmjcok1Xm',$daemon);

var_dump($account);


?>

This will give the response of

array(1) {
  ["result"]=>
  array(5) {
    ["account_data"]=>
    array(9) {
      ["Account"]=>
      string(34) "cnKwvH78cUTAvZbm8TWZXqdsWhmjcok1Xm"
      ["Balance"]=>
      string(17) "38952191430400000"
      ["Flags"]=>
      int(0)
      ["LedgerEntryType"]=>
      string(11) "AccountRoot"
      ["OwnerCount"]=>
      int(0)
      ["PreviousTxnID"]=>
      string(64) "9206D86D80FC2F80922B38F10F43CD2ACE8C80BE0280E2DE6781707CC9FA073A"
      ["PreviousTxnLgrSeq"]=>
      int(191609)
      ["Sequence"]=>
      int(675)
      ["index"]=>
      string(64) "D704E1180AEC7C58F832B9C80AEEF5C8A58BBEBBA56EA70B56327859E97D3C2E"
    }
    ["ledger_current_index"]=>
    int(191628)
    ["queue_data"]=>
    array(1) {
      ["txn_count"]=>
      int(0)
    }
    ["status"]=>
    string(7) "success"
    ["validated"]=>
    bool(false)
  }
}

Get Transaction on the CSCL

To retrieve data on a transaction use the script below

<?php

$daemon = 'http://xxxxxxxxxx:8443';

function getTx($tx,$daemon) {

$ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $daemon);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, '

       { "method" : "tx", "params" : [ {"transaction": "'.$tx.'"}] }

    ');
    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;
}

$tx = getTx('9206D86D80FC2F80922B38F10F43CD2ACE8C80BE0280E2DE6781707CC9FA073A',$daemon);

var_dump($tx);


?>

This gives the following output

array(1) {
  ["result"]=>
  array(17) {
    ["Account"]=>
    string(34) "cnKwvH78cUTAvZbm8TWZXqdsWhmjcok1Xm"
    ["Amount"]=>
    string(13) "1000000000000"
    ["Destination"]=>
    string(34) "cKyC8KSX1WZH6jTkJb4ntouYvQkuJ1RZVC"
    ["Fee"]=>
    string(8) "25000000"
    ["Flags"]=>
    int(2147483648)
    ["LastLedgerSequence"]=>
    int(191613)
    ["Sequence"]=>
    int(674)
    ["SigningPubKey"]=>
    string(66) "02F845799CAE9AE8421E0AEE0D93526AD21D882A911D93A46AFB17826B923A41C0"
    ["TransactionType"]=>
    string(7) "Payment"
    ["TxnSignature"]=>
    string(140) "3044022039A974644241ED22A4F733CF61B2CD40CED342B926F83704CC6F70CFA3D182B8022047150EA7F903B4CCB1BC085C1D9145DDE13687FDF008EB5DEB344FC79C4495A3"
    ["date"]=>
    int(633433350)
    ["hash"]=>
    string(64) "9206D86D80FC2F80922B38F10F43CD2ACE8C80BE0280E2DE6781707CC9FA073A"
    ["inLedger"]=>
    int(191609)
    ["ledger_index"]=>
    int(191609)
    ["meta"]=>
    array(4) {
      ["AffectedNodes"]=>
      array(2) {
        [0]=>
        array(1) {
          ["ModifiedNode"]=>
          array(6) {
            ["FinalFields"]=>
            array(5) {
              ["Account"]=>
              string(34) "cKyC8KSX1WZH6jTkJb4ntouYvQkuJ1RZVC"
              ["Balance"]=>
              string(13) "2000000000000"
              ["Flags"]=>
              int(0)
              ["OwnerCount"]=>
              int(0)
              ["Sequence"]=>
              int(1)
            }
            ["LedgerEntryType"]=>
            string(11) "AccountRoot"
            ["LedgerIndex"]=>
            string(64) "8DEA01AE8B1765DD9BBC9B0AC3986A1CEB59F3F0843C20052A0060ACE20D1532"
            ["PreviousFields"]=>
            array(1) {
              ["Balance"]=>
              string(13) "1000000000000"
            }
            ["PreviousTxnID"]=>
            string(64) "B04F53E22DBB4723D8C35622A2985FC27A301F9BDFD2F4C9C3D1184E63A156D2"
            ["PreviousTxnLgrSeq"]=>
            int(191606)
          }
        }
        [1]=>
        array(1) {
          ["ModifiedNode"]=>
          array(6) {
            ["FinalFields"]=>
            array(5) {
              ["Account"]=>
              string(34) "cnKwvH78cUTAvZbm8TWZXqdsWhmjcok1Xm"
              ["Balance"]=>
              string(17) "38952191430400000"
              ["Flags"]=>
              int(0)
              ["OwnerCount"]=>
              int(0)
              ["Sequence"]=>
              int(675)
            }
            ["LedgerEntryType"]=>
            string(11) "AccountRoot"
            ["LedgerIndex"]=>
            string(64) "D704E1180AEC7C58F832B9C80AEEF5C8A58BBEBBA56EA70B56327859E97D3C2E"
            ["PreviousFields"]=>
            array(2) {
              ["Balance"]=>
              string(17) "38953191455400000"
              ["Sequence"]=>
              int(674)
            }
            ["PreviousTxnID"]=>
            string(64) "B04F53E22DBB4723D8C35622A2985FC27A301F9BDFD2F4C9C3D1184E63A156D2"
            ["PreviousTxnLgrSeq"]=>
            int(191606)
          }
        }
      }
      ["TransactionIndex"]=>
      int(0)
      ["TransactionResult"]=>
      string(10) "tesSUCCESS"
      ["delivered_amount"]=>
      string(13) "1000000000000"
    }
    ["status"]=>
    string(7) "success"
    ["validated"]=>
    bool(true)
  }
}

Get Latest Transactions on the CSCL

To receive a list of the latest Transactions use the following script

<?php

$daemon = 'http://xxxxxxxxxxx:8443';

function latestTx($daemon) {

$ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $daemon);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, '

       { "method" : "tx_history", "params" : [ {"start": 0}] }

    ');
    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;
}

$array = latestTx($daemon);

var_dump($array);


?>

This will give an output of

array(1) {
  ["result"]=>
  array(3) {
    ["index"]=>
    int(0)
    ["status"]=>
    string(7) "success"
    ["txs"]=>
    array(20) {
      [0]=>
      array(13) {
        ["Account"]=>
        string(34) "cnKwvH78cUTAvZbm8TWZXqdsWhmjcok1Xm"
        ["Amount"]=>
        string(13) "1000000000000"
        ["Destination"]=>
        string(34) "cKyC8KSX1WZH6jTkJb4ntouYvQkuJ1RZVC"
        ["Fee"]=>
        string(8) "25000000"
        ["Flags"]=>
        int(2147483648)
        ["LastLedgerSequence"]=>
        int(191613)
        ["Sequence"]=>
        int(674)
        ["SigningPubKey"]=>
        string(66) "02F845799CAE9AE8421E0AEE0D93526AD21D882A911D93A46AFB17826B923A41C0"
        ["TransactionType"]=>
        string(7) "Payment"
        ["TxnSignature"]=>
        string(140) "3044022039A974644241ED22A4F733CF61B2CD40CED342B926F83704CC6F70CFA3D182B8022047150EA7F903B4CCB1BC085C1D9145DDE13687FDF008EB5DEB344FC79C4495A3"
        ["hash"]=>
        string(64) "9206D86D80FC2F80922B38F10F43CD2ACE8C80BE0280E2DE6781707CC9FA073A"
        ["inLedger"]=>
        int(191609)
        ["ledger_index"]=>
        int(191609)
      }
      [1]=>
      array(13) {
        ["Account"]=>
        string(34) "cnKwvH78cUTAvZbm8TWZXqdsWhmjcok1Xm"
        ["Amount"]=>
        string(13) "1000000000000"
        ["Destination"]=>
        string(34) "cKyC8KSX1WZH6jTkJb4ntouYvQkuJ1RZVC"
        ["Fee"]=>
        string(8) "25000000"
        ["Flags"]=>
        int(2147483648)
        ["LastLedgerSequence"]=>
        int(191610)
        ["Sequence"]=>
        int(673)
        ["SigningPubKey"]=>
        string(66) "02F845799CAE9AE8421E0AEE0D93526AD21D882A911D93A46AFB17826B923A41C0"
        ["TransactionType"]=>
        string(7) "Payment"
        ["TxnSignature"]=>
        string(140) "30440220659DA5093FAC1239711CDA979111BBB292BD09416278181F5267A51A6810C235022011E48EBE4E8BC534DBBC55EEF50BCDE9AE987F6DD9BFB29A008B6C9448F492C8"
        ["hash"]=>
        string(64) "B04F53E22DBB4723D8C35622A2985FC27A301F9BDFD2F4C9C3D1184E63A156D2"
        ["inLedger"]=>
        int(191606)
        ["ledger_index"]=>
        int(191606)
      }
........