bchavez / Coinbase

:moneybag: A .NET/C# implementation of the Coinbase API.
https://developers.coinbase.com/api/v2
MIT License
170 stars 92 forks source link

I keep on getting invalid signature on coinbase api with curl php #49

Closed SnaYxchg closed 5 years ago

SnaYxchg commented 5 years ago

`<?php $time = time(); $method = "GET"; $path = '/v2/accounts'; $sign = base64_encode(hash_hmac("sha256", $time.$method.$path, $api_secret));

$headers = array( "CB-VERSION: 2018-12-23" "CB-ACCESS-SIGN: ".$sign, "CB-ACCESS-TIMESTAMP: ".$time, "CB-ACCESS-KEY: ".$api_key, "Content-Type: application/json" );

$ch = curl_init('https://api.coinbase.com'.$path);

curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

if(curl_errno($ch)) { echo ': '.curl_error($ch); } else { var_dump($result); }

curl_close($ch);

?>`

Please help me fix this

bchavez commented 5 years ago

Hello @shivamnayyar2003,

This repository is for the C# library only.

You might have better luck asking at and using the official Coinbase library for PHP here: https://github.com/coinbase/coinbase-php

Wish I could help, but I haven't written PHP in 17 years.

Thanks, Brian