option-trx.php 602 B

123456789101112131415161718192021
  1. <?php
  2. include_once '../vendor/autoload.php';
  3. $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
  4. $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
  5. $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
  6. try {
  7. $tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
  8. } catch (\IEXBase\TronAPI\Exception\TronException $e) {
  9. exit($e->getMessage());
  10. }
  11. //option 1
  12. $tron->sendTransaction('to',0.1, 'hello');
  13. //option 2
  14. $tron->send('to',0.1);
  15. //option 3
  16. $tron->sendTrx('to',0.1);