peterhuynh Posted April 14, 2015 Share Posted April 14, 2015 Hello world, I'm trying to submit an order at a bitcoin exchange. This is their example: $nonce = time(); $token = 'xoxoxoxoxoxoxoxox'; $secret = ‘qwertyuioplkjhgfdsa’; $path = '/api2/user/order.json'; $params = array( 'amount' => '0.1', 'mode' => 'buy', 'price' => '965.45' ); //param values must be appended in alphabetical order by key to the message $message = “{$nonce}{$token}{$path}0.1buy965.45”; $signature = hash_hmac(‘sha256’, $message, $secret); And I use cURL to post that stuff: $ch = curl_init('https://www.cavirtex.com/api2/user/order.json'); curl_setopt($ch, CURLOPT_HTTPHEADER, $signature); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($message)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); It doesn't work. I get this: {"status": "error", "message": "No token key in requests"} Help? Please? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/295563-post-using-curl-to-bitcoin-exchange/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.