how to send money using json-rpc in bitcoin-cli for php?

2

1

$bitcoin->sendfrom($this->session->userdata('account'), $_POST['address'], number_format($_POST['amount'], 8));

but this isn't working. i got everything via json-rpc. but can't send or move money using json-rpc. what is the problem?

Md Shahadat Hossain

Posted 2015-06-08T14:13:33.993

Reputation: 197

Answers

1

The suggested library for Bitcoin JSON-RPC via PHP is the EasyBitcoin-PHP library. Source

Here's a simple example:

<?php 
require("easybitcoin.php");

//authenticate
$bitcoin = new Bitcoin("RPCusername", "RPCpassword"); 

//execute ternary command
$send = $bitcoin->sendtoaddress("1SomeBitcoinAddy", 1); 
echo $send ? $send : "Oops an error: ".$bitcoin->error;   
?> 

The first argument for sendtoaddress() is the address you want to send funds to, the second is the amount in whole bitcoins.

m1xolyd1an

Posted 2015-06-08T14:13:33.993

Reputation: 3 356

-1

if(number_format($_POST['amount'], 8)>.00009){

$amount=number_format($_POST['amount'], 8);

$bitcoin->sendfrom($this->session->userdata('account'), $_POST['address'], (float)$amount);

}
else{

echo "Tumbling is not possible vai php";

}

Md Shahadat Hossain

Posted 2015-06-08T14:13:33.993

Reputation: 197