Bitcoin Forum

Bitcoin => Project Development => Topic started by: anthony_ on June 15, 2011, 04:13:34 AM



Title: Auto BTC sending PHP script
Post by: anthony_ on June 15, 2011, 04:13:34 AM
Code:
<?php
while(1) {
$bitcoind_path '"%ProgramFiles(x86)%\Bitcoin\daemon\bitcoind"';
$sendtoaddress 'fdasfad';
$tax 0.0005;
$betamount 0.1;
$minimumbalance 0.0;
$strbalance =  exec($bitcoind_path.' getbalance');
$balance floatval($strbalance);
if($balance >= $betamount $tax && $balance - ($betamount $tax) > $minimumbalance) {
echo exec($bitcoind_path.' sendtoaddress '$sendtoaddress ' ' $betamount) . '\n';
echo 'sent!';
} else {
sleep(10);
}
}
?>

I use it for sites like bitcoin lottery (http://bitcoin.dyndns.info/bt/) and such so I can continue to waste my mining earnings :D

I will add JSON-RPC support in the future, this was just a test script.

If you like it consider donating a small amount to 17kKVg1NP8ciHG3qKoZirc7UP3NE1AFQC6


Title: Re: Auto BTC sending PHP script
Post by: NothinG on June 15, 2011, 07:29:23 AM
Code:
<?php
while(1) {
$bitcoind_path '"%ProgramFiles(x86)%\Bitcoin\daemon\bitcoind"';
$sendtoaddress 'fdasfad';
$tax 0.0005;
$betamount 0.1;
$minimumbalance 0.0;
$strbalance =  exec($bitcoind_path.' getbalance');
$balance floatval($strbalance);
if($balance >= $betamount $tax && $balance - ($betamount $tax) > $minimumbalance) {
echo exec($bitcoind_path.' sendtoaddress '$sendtoaddress ' ' $betamount) . '\n';
echo 'sent!';
} else {
die();
}
}
?>

Changed your sleep() to die(). I can't see any point in retrying the loop if there isn't enough money.


Title: Re: Auto BTC sending PHP script
Post by: anthony_ on June 15, 2011, 08:25:53 AM
Code:
<?php
while(1) {
$bitcoind_path '"%ProgramFiles(x86)%\Bitcoin\daemon\bitcoind"';
$sendtoaddress 'fdasfad';
$tax 0.0005;
$betamount 0.1;
$minimumbalance 0.0;
$strbalance =  exec($bitcoind_path.' getbalance');
$balance floatval($strbalance);
if($balance >= $betamount $tax && $balance - ($betamount $tax) > $minimumbalance) {
echo exec($bitcoind_path.' sendtoaddress '$sendtoaddress ' ' $betamount) . '\n';
echo 'sent!';
} else {
die();
}
}
?>

Changed your sleep() to die(). I can't see any point in retrying the loop if there isn't enough money.

It loops over and over again until there is money then it sends it.


Title: Re: Auto BTC sending PHP script
Post by: NothinG on June 15, 2011, 08:30:24 AM
It loops over and over again until there is money then it sends it.
Oh, I wasn't thinking very long term usage.
I see how this script works now.

Good idea. :)


Title: Re: Auto BTC sending PHP script
Post by: anthony_ on June 15, 2011, 09:09:28 AM
Yeah, I've been trying to win the jackpot but no luck so far :(