How to get a string with new address using coinbase api and php -
i'm trying use coinbase wallet php library (from here:https://github.com/coinbase/coinbase-php) .
$client->createaccountaddress($account, $address);
- when using - creates new address. want print in customer.
$address = $client->getaccountaddress($account, $addressid);
- tried use it, dont know put in $addressid variable. please me.
example of code i'm using:
<?php require_once('vendor/autoload.php'); use coinbase\wallet\client; use coinbase\wallet\configuration; use coinbase\wallet\resource\address; parse_str($_server["query_string"]); $apikey = 'myapi'; $apisecret = 'apisecret'; $configuration = configuration::apikey($apikey, $apisecret); $client = client::create($configuration); $account = $client->getprimaryaccount(); $address = new address([ 'name' => 'new address16' ]); $client->createaccountaddress($account, $address); $addresses = $client->getaccountaddress($account, $address); //i don't know put in second variable echo "network: ".json_encode($addresses->getaddress)."<br>"; ?>
so, thats how works, generate new address , print it.
<?php require_once('vendor/autoload.php'); use coinbase\wallet\client; use coinbase\wallet\configuration; use coinbase\wallet\resource\address; parse_str($_server["query_string"]); $apikey = 'api'; $apisecret = 'secret'; $configuration = configuration::apikey($apikey, $apisecret); $client = client::create($configuration); $account = $client->getprimaryaccount(); $address = new address([ 'name' => 'new address19' ]); $add = $client->createaccountaddress($account, $address); $addressid = $client->getaccountaddresses($account); $addresses = $client->getaccountaddress($account, $addressid->getfirstid()); echo "your address is: ".json_encode($addresses->getaddress())."<br>"; ?>
Comments
Post a Comment