php-binance-api: Cannot connect on local machine

Getting signedRequest error: {“code”:-1022,“msg”:“Signature for this request is not valid.”} balanceData error: Please make sure your system time is synchronized, or pass the useServerTime option.

I have try using the useServerTime too but no luck

Platform:

  • windows
  • XamPP

php version:

  • 7.2.4

code

require 'vendor/autoload.php';
$api = new Binance\API( "xxxxx", "xxxxx" );
$api->useServerTime();

// Get latest price of a symbol
$ticker = $api->prices();
echo '<pre>';
print_r($ticker); // List prices of all symbols
echo '</pre>';
echo "Price of BNB: {$ticker['BNBBTC']} BTC.\n";

// Get all of your positions, including estimated BTC value  - This is where the api doesn't work..
$balances = $api->balances($ticker);
print_r($balances);

thank you

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

@jaggedsoft Yes it was the api keys. Maybe you can make a more friendly error message saying: Invalid API/Secret keys. Please check your keys and try again.