Skip to content

Commit

Permalink
Fixed Signature for this request is not valid on POST requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Eyrick authored Aug 28, 2019
1 parent 1d22afb commit cad1b71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions php-binance-api.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/*
* ============================================================
* @package php-binance-api
Expand Down Expand Up @@ -893,7 +892,9 @@ private function httpRequest(string $url, string $method = "GET", array $params
$query = http_build_query($params, '', '&');
$signature = hash_hmac('sha256', $query, $this->api_secret);
if ($method === "POST") {
$endpoint = $base . $url . '?' . 'signature=' . $signature;
$endpoint = $base . $url;
$params['signature'] = $signature; // signature needs to be inside BODY
$query = http_build_query($params, '', '&'); // rebuilding query
} else {
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
}
Expand Down

0 comments on commit cad1b71

Please sign in to comment.