1. Go to this page and download the library: Download snlbaral/coinbase-api-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$refreshToken = file_get_contents('refreshToken.txt');
$accessToken = $client->getAccessToken($refreshToken); //returns new access token valid for next 2 hours.
try {
$address = $client->getAddress($accessToken);
print_r($address);
//$address = json_decode($address,true);
//echo $address['data']['address'];
} catch (Exception $e) {
if($e->getCode()==401) {
$refreshToken = file_get_contents('refreshToken.txt');
$accessToken = $client->getAccessToken($refreshToken);
//Save/Update the this new access token to use it for next 2 hours
//Get Address using new access token
$address = $client->getAddress($accessToken);
print_r($address);
} else {
print_r($e->getMessage());
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.