PHP code example of pingleware / web3
1. Go to this page and download the library: Download pingleware/web3 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pingleware / web3 example snippets
use PINGLEWARE\Web3\Web3;
$web3 = null;
$arch = Web3::detectArchitecture();
$os = strtolower(PHP_OS);
if ($arch == "ARM") {
$web3 = new Web3("http://192.168.0.103:8545",dirname(__FILE__)."/pingleware-deploy-cli_$os-arm64");
} else if ($arch == "x64") {
$web3 = new Web3("http://192.168.0.103:8545",dirname(__FILE__)."/pingleware-deploy-cli_$os-x64");
} else {
echo "architecture is UNKNOWN?\n";
exit;
}
echo 'Balance: '.$web3->eth_getBalance("0x5EaF72deD2e4E255C228f9070501974D3572c5d4")." ETH\n";
php -f index.php