Get List of Tokens on CSCL

Posted by

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"
          }
        .............

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s