Hello Everyone, I’m trying this :
$totalParams = 'recvWindow=60000×tamp=' . $timestamp;
$signature = hash_hmac ( "sha256", $totalParams , $secretKey );
$url = 'https://api.binance.com/api/v3/account';
$queryString = $totalParams . "&signature=" . $signature;
$options = array(
'http' => array(
'header' => "X-MBX-APIKEY: " . $apiKey,
'method' => 'GET',
'content' => $queryString
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
But I get the
403 forbidden error
, somebody knows why ? FYI from doc: HTTP 403 return code is used when the WAF Limit (Web Application Firewall) has been violated.
But I don’t know what this means and what to do about it ^^
Hi. There are several possible reasons for it. Please refer to this post.
Q: Why am I getting the following error?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD>
<BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this ti…
the querystring had to be attached to the url, and not put in the content…
See the working code :
$signature = hash_hmac ( "sha256", $totalParams , $this->secretKey );
$queryString = $totalParams . "&signature=" . $signature;
$queryurl = $url . '?' . $queryString;
$options = array(
'http' => array(
'header' => "X-MBX-APIKEY: " . $this->apiKey,
'method' => 'GET',
),
);
$context = stream_context_create($options);
$result = file_get_contents($queryurl, false, $context);