12345678910111213141516171819 |
- <?php
- $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
- $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
- $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
- try {
- $tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
- } catch (\IEXBase\TronAPI\Exception\TronException $e) {
- exit($e->getMessage());
- }
- try {
- $transaction = $tron->getTransactionBuilder()->sendTrx('to', 2,'fromAddress');
- $signedTransaction = $tron->signTransaction($transaction);
- $response = $tron->sendRawTransaction($signedTransaction);
- } catch (\IEXBase\TronAPI\Exception\TronException $e) {
- die($e->getMessage());
- }
|