Skip to content

Commit

Permalink
added signature to public functions
Browse files Browse the repository at this point in the history
  • Loading branch information
joeri-vv committed May 29, 2019
1 parent 6792120 commit cf368b8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bitvavo.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ public function debugToConsole($message) {

function sendPublic($url, $params, $method, $data) {
$curl = createCurl($url, $method, $params);
$endpoint = str_replace(array($this->base), array(''), $url);
if ($this->apiKey != "") {
$now = (time()*1000);
$query = http_build_query($params, '', '&');
if (count($params) > 0) {
$endpointParams = $endpoint . '?' . $query;
} else {
$endpointParams = $endpoint;
}
$sig = createSignature($now, $method, $endpointParams, [], $this->apiSecret);
$headers = array(
'Bitvavo-Access-Key: ' . $this->apiKey,
'Bitvavo-Access-Signature: ' . $sig,
'Bitvavo-Access-Timestamp: ' . (string)$now,
'Bitvavo-Access-Window: ' . (string)$this->accessWindow,
'Content-Type: application/json'
);
echo implode(',', $headers);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
}
$output = curl_exec($curl);
$json = json_decode($output, true);
return $json;
Expand Down

0 comments on commit cf368b8

Please sign in to comment.