Skip to content

Commit cf368b8

Browse files
committed
added signature to public functions
1 parent 6792120 commit cf368b8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

bitvavo.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,26 @@ public function debugToConsole($message) {
115115

116116
function sendPublic($url, $params, $method, $data) {
117117
$curl = createCurl($url, $method, $params);
118+
$endpoint = str_replace(array($this->base), array(''), $url);
119+
if ($this->apiKey != "") {
120+
$now = (time()*1000);
121+
$query = http_build_query($params, '', '&');
122+
if (count($params) > 0) {
123+
$endpointParams = $endpoint . '?' . $query;
124+
} else {
125+
$endpointParams = $endpoint;
126+
}
127+
$sig = createSignature($now, $method, $endpointParams, [], $this->apiSecret);
128+
$headers = array(
129+
'Bitvavo-Access-Key: ' . $this->apiKey,
130+
'Bitvavo-Access-Signature: ' . $sig,
131+
'Bitvavo-Access-Timestamp: ' . (string)$now,
132+
'Bitvavo-Access-Window: ' . (string)$this->accessWindow,
133+
'Content-Type: application/json'
134+
);
135+
echo implode(',', $headers);
136+
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
137+
}
118138
$output = curl_exec($curl);
119139
$json = json_decode($output, true);
120140
return $json;

0 commit comments

Comments
 (0)