Salve,
ho un problema che non riesco a superare,
devo utilizzare delle API di "Coinbase" per gestire varie funzioni,
ho un esempio ufficiale in Python, vorrei realizzarlo in php, ho fatto un test ma chiaramente non funziona, credo con certezza che ho proprio sbagliato strada.
Potreste darmi una mano per farlo funzionare ??

Python ufficiale:
codice:
API_KEY = 'API_KEY'
API_SECRET = 'API_SECRET'


# Create custom authentication for Coinbase API
class CoinbaseWalletAuth(AuthBase):
    def __init__(self, api_key, secret_key):
        self.api_key = api_key
        self.secret_key = secret_key


    def __call__(self, request):
        timestamp = str(int(time.time()))
        message = timestamp + request.method + request.path_url + (request.body or '')
        signature = hmac.new(self.secret_key, message, hashlib.sha256).hexdigest()


        request.headers.update({
            'CB-ACCESS-SIGN': signature,
            'CB-ACCESS-TIMESTAMP': timestamp,
            'CB-ACCESS-KEY': self.api_key,
        })
        return request


api_url = 'https://api.coinbase.com/v2/'
auth = CoinbaseWalletAuth(API_KEY, API_SECRET)


# Get current user
r = requests.get(api_url + 'user', auth=auth)
print r.json()
# {u'data': {u'username': None, u'resource': u'user', u'name': u'User'...


# Send funds
tx = {
    'type': 'send',
    'to': 'user@example.com',
    'amount': '10.0',
    'currency': 'USD',
}
r = requests.post(api_url + 'accounts/primary/transactions', json=tx, auth=auth)
print r.json()
# {u'data': {u'status': u'pending', u'amount': {u'currency': u'BTC'...

Il mio test in php:
codice:
$API_KEY = 'API_KEY';
$API_SECRET = 'API_SECRET';


$timestamp = time();
$message = $timestamp + 'POST' + 'my-url' + '';
$signature = hash_hmac('SHA256', $message, $API_SECRET);


$headers = array(
					'CB-ACCESS-SIGN: '.signature,
					'CB-ACCESS-TIMESTAMP: '.timestamp,
					'CB-ACCESS-KEY: '.api_key
				); 


$api_url = 'https://api.coinbase.com/v2/';


$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($ch, CURLOPT_POST, 1);
$data = curl_exec($ch); 


if(curl_errno($ch))
{ 
    echo "Errore: " . curl_error($ch); 
}
else
{ 
    var_dump($data); 
    curl_close($ch); 
}

Ho scritto codice procedurale senza classe per comodità.
Quanti errori ho fatto ??