'; $secret_key = "your private key"; $secret_key_encoded = base64_decode($secret_key); $public_key = "your public key"; $method = "GET"; $path = "/v3/orders"; $milliseconds = round(microtime(true) * 1000); $data = ""; // works - all orders are listed //$dataset = array( "marketId" => "ETH-AUD"); //$data = json_encode($dataset); // does not work // $data = '{"marketId":"ETH-AUD"}'; // does not work $msg = $method . $path . $milliseconds . $data ; echo "Message is:\n" . $msg; $encodedMsg = hash_hmac('sha512', $msg, $secret_key_encoded, true); $base64Msg = base64_encode($encodedMsg); echo "Encoded Message is: \n" . $base64Msg . "
"; $headers = "Accept: application/json\r\n" . "'Content-Length': ". mb_strlen($data,'UTF-8') . "\r\n" . "Content-Type: application/json\r\n" . "BM-AUTH-APIKEY: " . $public_key . "\r\n" . "BM-AUTH-TIMESTAMP: " . $milliseconds . "\r\n" . "BM-AUTH-SIGNATURE: " . $base64Msg . "\r\n"; // Create a stream $opts = array( 'http'=>array( 'method'=>$method, 'header'=>$headers ) ); $context = stream_context_create($opts); var_dump($opts); // Open the file using the HTTP headers set above // changed path only $json = file_get_contents('https://api.btcmarkets.net'.$path, false, $context); var_dump($json); ?>