Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: spndr7 on June 24, 2013, 01:09:42 PM



Title: Passing parameters to bitcoin daemon using php library
Post by: spndr7 on June 24, 2013, 01:09:42 PM
Quote
<?php

 require_once 'jsonRPCClient.php';
 
  $bitcoin = new   jsonRPCClient('http://username:password@127.0.0.1:9999/');
 
   $json =$bitcoin->getnewaddress();        // here  parameter required
   var_dump($json);
  echo "</pre>";         

?>


How to pass parameter to function 'getnewaddress' ?


Title: Re: Passing parameters to bitcoin daemon using php library
Post by: spndr7 on June 24, 2013, 01:40:14 PM
library used here is

http://jsonrpcphp.org/


Title: Re: Passing parameters to bitcoin daemon using php library
Post by: spndr7 on June 25, 2013, 05:07:43 AM
no one uses php with bitcoin, or is my question wrong ?


Title: Re: Passing parameters to bitcoin daemon using php library
Post by: domob on June 25, 2013, 10:37:36 AM
no one uses php with bitcoin, or is my question wrong ?

I use it (well, namecoin to be precise) but have written my own RPC call library based on the command-line tool.  I don't know about the one you use.  (I can point you to my code if you want to switch, but I guess that would be even more complicated.)


Title: Re: Passing parameters to bitcoin daemon using php library
Post by: kjj on June 25, 2013, 12:11:33 PM
Quote
<?php

 require_once 'jsonRPCClient.php';
 
  $bitcoin = new   jsonRPCClient('http://username:password@127.0.0.1:9999/');
 
   $json =$bitcoin->getnewaddress();        // here  parameter required
   var_dump($json);
  echo "</pre>";         

?>


How to pass parameter to function 'getnewaddress' ?

Just pass the parameters in the getnewaddress() call.

Code:
$json = $bitcoin->getnewaddress("Account_Name");


Title: Re: Passing parameters to bitcoin daemon using php library
Post by: spndr7 on June 26, 2013, 03:35:12 AM
Quote
Just pass the parameters in the getnewaddress() call.

Code:
$json = $bitcoin->getnewaddress("Account_Name");

Thanks for help.