How Can I pass params?
Closed this issue · 3 comments
serhack commented
Hello,
your library is very useful for me. I need some suggestion:
How can I pass parameters ?
I'm using this:
$params = array("I" => "SI");
$bitcoin->method($params);
Is that correct?
PetrifiedLasagna commented
@serhack
This snippet of code is from the library's __call
method
// If no parameters are passed, this will be an empty array
$params = array_values($params);
...
// Build the request, it's ok that params might have any empty array
$request = json_encode(array(
'method' => $method,
'params' => $params,
'id' => $this->id
));
So depending on the parameters of the RPC command the general format will be the following.
$myVar->nameofRPCcommand(...);
For example a command that takes two strings will be
$myVar->nameofRPCcommand($myStr1, $myStr2);
Or with a string followed by an array
$myVar->nameofRPCcommand($myStr, $myArr);
Hope this answered your question.
aceat64 commented
@PetrifiedLasagna is correct :)
serhack commented
Thanks @PetrifiedLasagna :)