Skip to content
Advertisement

Making Curl to PHP request json rpc

I am trying to connect to Electroneum wallet rpc. The example Curl request is:-

JavaScript

Which works perfectly fine on machine side. But when I try PHP like this

JavaScript

It returns { "error": { "code": -32601, "message": "Method not found" }, "id": "0", "jsonrpc": "2.0" }. I don’t know why it’s not working, maybe due to –digest. Help needed

Advertisement

Answer

You forgot to remove a single quote in your method name in your request options:

JavaScript

should be:

JavaScript

But anyway, if you plan to do multiple different calls to their JSON-RPC API, I would advise you to use a client library that does all the JSON-RPC protocol handling for you, for example jsonrpc/jsonrpc.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement