0

I have a smart contract. All what I need is to make a PHP script that will get some public data from smart contract using it's address. How can I do that? Maybe there is some libraries?

1

Yes, this is possible. I don't know if there are PHP libraries available, but as long as you can make an HTTP request and deal with JSON, this is pretty easy to do. See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call.

You can send such a JSON-RPC call to any Ethereum node. Infura is a public node that you could use.

  • Ok. But how I can get data from mapping in the contract? How I need to send JSON request? – M. Jhon Jan 9 '18 at 18:08
  • Give github.com/sc0Vu/web3.php a try. Specifically, $contract->at($contractAddress)->call($functionName, $params, $callback);. – user19510 Jan 9 '18 at 19:45
  • You could use a library like Ethereum-PHP which is documented. – digitaldonkey Mar 21 '18 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.