Skip to content

Commit cad1b71

Browse files
author
Jon Eyrick
authored
Fixed Signature for this request is not valid on POST requests
1 parent 1d22afb commit cad1b71

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

php-binance-api.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/*
43
* ============================================================
54
* @package php-binance-api
@@ -893,7 +892,9 @@ private function httpRequest(string $url, string $method = "GET", array $params
893892
$query = http_build_query($params, '', '&');
894893
$signature = hash_hmac('sha256', $query, $this->api_secret);
895894
if ($method === "POST") {
896-
$endpoint = $base . $url . '?' . 'signature=' . $signature;
895+
$endpoint = $base . $url;
896+
$params['signature'] = $signature; // signature needs to be inside BODY
897+
$query = http_build_query($params, '', '&'); // rebuilding query
897898
} else {
898899
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
899900
}

0 commit comments

Comments
 (0)