Hi,
i have this code:
include("conf/json.php");
$send_amount = 10000;
$amount = 0;
$i = 0;
$j = 1;
while($amount < $send_amount){
$listunspent = $wallet->listunspent($j,$j + 50);
foreach($listunspent as $trans){
var_dump($trans['amount']);
$translist[$i]['txid'] = $trans['txid'];
$translist[$i]['vout'] = $trans['vout'];
$translist[$i]['scriptPubKey'] = $trans['scriptPubKey'];
$addr[$i] = $trans['address'];
$amount += $trans['amount'];
$i++;
if($amount > $send_amount)break;
}
$j += 50;
}
echo $amount . "\n\n";
$rest = $amount - $send_amount - 0.001;
$where['BAYdf2ghtRCATqfsW1BcUWdHL6qrRuhVoU'] = $send_amount;
$where['B9SkKrC7RQp9wiKKLxRNspi3ms1SQF4rF8'] = $rest;
//var_dump($kam);
$json_translist = json_encode($translist);
echo $json_translist . "\n\n";
$json_where = json_encode($where);
echo $json_where . "\n\n";
//var_dump($wallet->listunspent());
$rawtrans = $wallet->createrawtransaction($json_translist, $json_where);
var_dump($rawtrans);
//var_dump($listunspent);
?>
but output is :
float(9530.68186146)
float(1523.1469796)
11053.82884106
[{"txid":"2ab8f9446d3c12e242fa9ab5e0e0249b0111af4d17f7903b6e28f6b2290c2a0b","vout":1,"scriptPubKey":"2102e72e0784a8e9e270229f7bca688ef8629e480fe37f1e5cf9ed9e4765326d61eeac"},{"txid":"2dfb5acb368704f7b71aa2e5142362b6642151d6984851c3b0187d05bda4ea07","vout":1,"scriptPubKey":"2103ba2442dd62881a4350af847d1ff85bbd1ab61c14b10aa1a26eed28c628310a5fac"}]
{"BAYdf2ghtRCATqfsW1BcUWdHL6qrRuhVoU":10000,"B9SkKrC7RQp9wiKKLxRNspi3ms1SQF4rF8":1053.82784106}
PHP Warning: fopen(http://...@localhost:8765/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
in /home/pisko/www/novy_faucet/tridy/jsonRPCClient.php on line 132
PHP Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://****:****@localhost:****/' in /home/pisko/www/novy_faucet/tridy/jsonRPCClient.php:140
Stack trace:
#0 /home/pisko/www/novy_faucet/raw.php(32): jsonRPCClient->__call('createrawtransa...', Array)
#1 /home/pisko/www/novy_faucet/raw.php(32): jsonRPCClient->createrawtransaction('[{"txid":"2ab8f...', '{"BAYdf2ghtRCAT...')
#2 {main}
thrown in /home/pisko/www/novy_faucet/tridy/jsonRPCClient.php on line 140
any idea? when i try to create it from console with same data from this output it work
czecoin createrawtransaction '[{"txid":"2ab8f9446d3c12e242fa9ab5e0e0249b0111af4d17f7903b6e28f6b2290c2a0b","vout":1,"scriptPubKey":"2102e72e0784a8e9e270229f7bca688ef8629e480fe37f1e5cf9ed9e4765326d61eeac"},{"txid":"2dfb5acb368704f7b71aa2e5142362b6642151d6984851c3b0187d05bda4ea07","vout":1,"scriptPubKey":"2103ba2442dd62881a4350af847d1ff85bbd1ab61c14b10aa1a26eed28c628310a5fac"}]' '{"BAYdf2ghtRCATqfsW1BcUWdHL6qrRuhVoU":10000,"B9SkKrC7RQp9wiKKLxRNspi3ms1SQF4rF8":1053.82874106}'
010000005d3f0e57020b2a0c29b2f6286e3b90f7174daf11019b24e0e0b59afa42e2123c6d44f9b82a0100000000ffffffff07eaa4bd057d18b0c3514898d6512164b6622314e5a21ab7f7048736cb5afb2d0100000000ffffffff020010a5d4e80000001976a91442dd947fd441ea8f1ce64ec521ea8f91489e545c88acfa0b4f89180000001976a91436c88698b75115806c6c6c0cb02fb1d50133070188ac00000000