Why isn’t the script running? With the GET requests (balances, account, klines) the signature works, only with the POST requests do I get this error message.
According to the documentation, the signature is also correct and the ORDER is also executed in Postman. Just not on my web server.
Please help.
Here’s my code, exactly the same as in Postman:
<?php
include('API.php');
$ServerTimeUrl='https://testnet.binance.vision/api/v3/time';
$ClassServerTime = new APIREST($ServerTimeUrl);
$CallServerTime = $ClassServerTime->call(array());
$DecodeCallTime= json_decode($CallServerTime);
$Time = $DecodeCallTime->serverTime;
$ApiKey = $myapikey; // the Api key provided by binance
$ApiSecret = $myapisecret; // the Secret key provided by binance
$Timestamp = 'timestamp='.$Time; // build timestamp type url get
$Signature = hash_hmac('SHA256',$Timestamp ,$ApiSecret); // build firm with sha256
$curl = curl_init();
$Symbol = 'BNBUSDT';
$Side = 'BUY';
$Type = 'MARKET';
$Quantity = '10';
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://testnet.binance.vision/api/v3/order?symbol='.$Symbol.'&side='.$Side.'&type='.$Type.'&quantity='.$Quantity.'×tamp='.$Time.'&signature='.$Signature,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'X-MBX-APIKEY: J4BhGpAmTyU5FQJxUEM905aKQqWoxo2uMfTgORiy9x49eqQ0P1Kdp9wX765VMkbg'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>