Bitcoin Forum
January 22, 2019, 07:54:10 PM *
News: Latest Bitcoin Core release: 0.17.1 [Torrent]
   Home   Help Search Login Register More  
Pages: [1]
Author Topic: bitcoin PHP json rpc error "JSON value is not an integer as expected"  (Read 85 times)
Sr. Member
Offline Offline

Activity: 392
Merit: 252

View Profile WWW
January 03, 2018, 12:01:02 AM
Last edit: January 03, 2018, 01:32:13 AM by btctousd81

i am trying to connect to my local bitcoind using php json library specified in

i 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


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;'

i am getting proper output, so its not issue with bitcoind., but looks like php library.

Pages: [1]
Jump to: is not available or authorized for sale. Do not believe any fake listings.
Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!