furqansiddiqui / erc20-php

Interact with Ethereum ERC20 Tokens
MIT License
164 stars 97 forks source link

Expected "application/json", got "text/html" when using hostname #22

Closed akegaviar closed 4 years ago

akegaviar commented 4 years ago

Thanks a lot for this package.

I'm wondering if you could please update it to work with node providers like Chainstack.

Chainstack nodes use Geth and support RPC. The only issue is that (as I understand) is this package expects an IP address and Chainstack uses a hostname with basic auth. A Geth node with RPC from Chainstack has a hostname like https://user-name:pass-word@nd-123-456-789.p2pify.com.

So using it is resulting in an error similar to this:

Fatal error: Uncaught EthereumRPC\Exception\ConnectionException: Expected "application/json", got "text/html" 

By looking here and here I think the package expects an IP address.

Thanks!

furqansiddiqui commented 4 years ago

All known issues have been resolved in latest release. Please checkout latest commit from master or 0.2.1 release.