Skip to content

Commit 2cf70fe

Browse files
author
Jon Eyrick
authored
Fix GET/POST requests by afsharsafavi
2 parents 24cddef + 80125c8 commit 2cf70fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

php-binance-api.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,10 @@ private function httpRequest(string $url, string $method = "GET", array $params
876876
}
877877
$query = http_build_query($params, '', '&');
878878
$signature = hash_hmac('sha256', $query, $this->api_secret);
879-
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
879+
if ($method === "POST") {
880+
$endpoint = $base . $url . '?' . 'signature=' . $signature;
881+
} else
882+
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
880883
curl_setopt($curl, CURLOPT_URL, $endpoint);
881884
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
882885
'X-MBX-APIKEY: ' . $this->api_key,
@@ -897,7 +900,7 @@ private function httpRequest(string $url, string $method = "GET", array $params
897900
// Post and postfields
898901
if ($method === "POST") {
899902
curl_setopt($curl, CURLOPT_POST, true);
900-
// curl_setopt($curlch, CURLOPT_POSTFIELDS, $query);
903+
curl_setopt($curlch, CURLOPT_POSTFIELDS, $query);
901904
}
902905
// Delete Method
903906
if ($method === "DELETE") {

0 commit comments

Comments
 (0)