Skip to content

Instantly share code, notes, and snippets.

@askaaqib
Created November 25, 2020 05:12
Show Gist options
  • Save askaaqib/af51dcf3336a7626097cc59951fc9c41 to your computer and use it in GitHub Desktop.
Save askaaqib/af51dcf3336a7626097cc59951fc9c41 to your computer and use it in GitHub Desktop.
Fund Account - Stellar PHP API
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
// See 01-create-account.php for where this was generated
$publicAccountId = 'GCCZACJX7DHEWGK5WJ2ONRGAJN2RBGGCX3OO4NF66JMJ4MNACKED577A';
// Use the testnet friendbot to add funds:
$response = file_get_contents('https://horizon-testnet.stellar.org/friendbot?addr=' . $publicAccountId);
// After a successful response, the account will have lumens from the testbot
if ($response !== false) {
print 'Success! Account is now funded.' . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment