Example #1
0
        curl_setopt($ch, CURLOPT_USERAGENT, 'JSON-RPC PHP Client');
        curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
        if ($this->username && $this->password) {
            curl_setopt($ch, CURLOPT_USERPWD, $this->username . ':' . $this->password);
        }
        $result = curl_exec($ch);
        $response = json_decode($result, true);
        curl_close($ch);
        return is_array($response) ? $response : array();
    }
}
$client = new Client("http://127.0.0.1:54121/chancecoin");
$client->authentication("chancecoin", "password");
// $result = $client->execute('reparse', array());
/*
$result = $client->execute('importPrivateKey', array('KybpV7G13H8Yc9G5dRVPqt3KsTaYQQnozX9xvdqy744F1jNUygh1'));
print_r($result);
print "\n";

$result = $client->execute('getBalance', array('1FAnfga47hhfNkxHJ7Qnh1HxxyVHgP2Hes'));
print_r($result);
print "\n";

$result = $client->execute('send', array('1GbWCwjHorFdFTuGzGk8tEtLctq4xxxqY9', '1FAnfga47hhfNkxHJ7Qnh1HxxyVHgP2Hes', 1000.0));
print_r($result);
print "\n";
*/
$result = $client->execute('getSends', array('1FAnfga47hhfNkxHJ7Qnh1HxxyVHgP2Hes'));