send-transaction.php 700 B

1234567891011121314151617181920212223
  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. $tron->setAddress('address');
  12. $tron->setPrivateKey('privateKey');
  13. try {
  14. $transfer = $tron->send( 'ToAddress', 1);
  15. } catch (\IEXBase\TronAPI\Exception\TronException $e) {
  16. die($e->getMessage());
  17. }
  18. var_dump($transfer);