I am not able to get JSON-RPC response via curl. It seems like is not accepting requests.
My bitcoin.conf
rpcuser=USER
rpcpassword=PASS
server=1
rpcport=9332
Running daemon
$ bitcoind -conf=~/.bitcoin/bitcoin.conf -daemon
Bitcoin server starting
Checking cli
$ bitcoin-cli -conf=~/.bitcoin/bitcoin.conf getinfo
{
"version": 140200,
"protocolversion": 70015,
"walletversion": 130000,
"balance": 0.00000000,
"blocks": 439348,
"timeoffset": 0,
"connections": 8,
"proxy": "",
"difficulty": 254620187304.0614,
"testnet": false,
"keypoololdest": 1500029964,
"keypoolsize": 100,
"paytxfee": 0.00000000,
"relayfee": 0.00001000,
"errors": ""
}
Testing curl
$ curl http://localhost:3333
curl: (7) Failed to connect to localhost port 3333: Connection refused
Of course, the port is wrong:
$ curl http://localhost:9332
JSONRPC server handles only POST requests
Making a post
$ curl http://localhost:8332 -H 'content-type:text/plain;' --data-binary ''
The output is always empty, doesn't matter if I add data or user,password. Is always empty:
$ curl http://localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://USER:PASS@localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://USER:PASS@localhost:9332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'
$ curl --user USER:PASS http://localhost:9332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'
Any ideas why is this happening? Don't know what else to try.
-v / --verbose