Last active
September 5, 2021 00:30
-
-
Save placecodex/25e69d7ddad8fcb4ba13004c976765d9 to your computer and use it in GitHub Desktop.
get balance ethereum php , guzzle, curl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
$url ='https://api.anyblock.tools/ethereum/ethereum/ropsten/rpc/ac-a196sasasd581576f/'; | |
$client = new Https(); | |
$opts = [ | |
//'timeout' => 4, | |
'json' => [ | |
'jsonrpc' => '1.0', | |
'method' => 'eth_getBalance', | |
'params' => ['0xC18c19eDf','latest'], | |
'id' => time() | |
] | |
]; | |
$request = $client->post($url,$opts); | |
$array = json_decode($request->getBody()->getContents()); | |
print_r($array); | |
} catch (\Exception $e) { | |
// will return user to previous screen with twilio error| | |
print_r($e->getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
start