i am trying to connect to my local bitcoind using php json library
https://github.com/aceat64/EasyBitcoin-PHP specified in
https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#PHPi am trying to get block data. e.g.
$bitcoin = new Bitcoin('user','password');
$blockhash = $bitcoin->getblockhash('502284') ;
i am getting
JSON value is not an integer as expected
on further debuggng
$curl_error = curl_error($curl);
(
[result] =>
[error] => Array
(
[code] => -1
[message] => JSON value is not an integer as expected
)
[id] => 1
)
this happens only with blockheight 502284 and not with other blocks.,
if i do this in command line using bitcoin-cli , then i can get proper output.,
but calling from php json/rpc i am getting warning and no result.
how can i fix this ? thanks for your time.[/code]
EDIT 1 :on further inspection it seems this is only affected to
getblockhash
as it returns output in int instead of string., and while json doesnt works properly if int starts with 0 ., so it gives warning .,
thats what i think.
EDIT 2 :if i do this
[root@localhost ]# curl --user user:password --data-binary '{"id":"curltest", "method": "getblockhash", "params": [502284] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
{"result":"0000000000000000001345b1216c6dfa6e3bdd2774d67c7a85ea6552e2245c08","error":null,"id":"curltest"}
i am getting proper output, so its not issue with bitcoind., but looks like php library.