Bitcoin Forum
May 08, 2024, 09:27:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Newbie help with RPC and PHP  (Read 1047 times)
rdonohoe (OP)
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
April 12, 2011, 05:48:54 PM
 #1

Hi,

I am a new user and very interested in Bitcoin. I have been playing around with the RPC with PHP and I am getting a problem:

Code:
<?php

require_once 'jsonRPCClient.php';
 
  
$bitcoin = new jsonRPCClient('http://user:pass@127.0.0.1:8332/');
  
  
$balance $bitcoin->getbalance();
  echo 
$balance '</br>';
  
  
$send $bitcoin->sendtoaddress("1FmxuVaSpyGk732TbKroFE4ouSebpiz3nb 0.01");
  
  echo 
$send '</br>';
  
  
$balance $bitcoin->getbalance();
  echo 
$balance '</br>';

My problem is that nothing seems to happen after the first balance is echoed. The 0.01 is not sent and the 2nd balance echo is not done.

Any help would be great.

1715160423
Hero Member
*
Offline Offline

Posts: 1715160423

View Profile Personal Message (Offline)

Ignore
1715160423
Reply with quote  #2

1715160423
Report to moderator
1715160423
Hero Member
*
Offline Offline

Posts: 1715160423

View Profile Personal Message (Offline)

Ignore
1715160423
Reply with quote  #2

1715160423
Report to moderator
Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715160423
Hero Member
*
Offline Offline

Posts: 1715160423

View Profile Personal Message (Offline)

Ignore
1715160423
Reply with quote  #2

1715160423
Report to moderator
1715160423
Hero Member
*
Offline Offline

Posts: 1715160423

View Profile Personal Message (Offline)

Ignore
1715160423
Reply with quote  #2

1715160423
Report to moderator
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5194
Merit: 12976


View Profile
April 12, 2011, 06:16:26 PM
 #2

If I remember correctly, you use multiple parameters like this:
Code:
$send = $bitcoin->sendtoaddress("1FmxuVaSpyGk732TbKroFE4ouSebpiz3nb", 0.01);

It also might be an array:
Code:
$send = $bitcoin->sendtoaddress(array("1FmxuVaSpyGk732TbKroFE4ouSebpiz3nb", 0.01));

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!