peterhuynh Posted February 15, 2015 Share Posted February 15, 2015 Hi, This is my third post and the first two were incredibly helpful. I'm learning a lot, so thank you contributers! This is what I'm working with: $nonce = time(); $token = ‘asdfghjklmnbvcxz’; $secret = ‘qwertyuioplkjhgfdsa’; $path = '/api2/user/order.json'; $params = array( 'amount' => '0.1', 'mode' => 'buy', 'currencypair' => 'BTCCAD', '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); I ran the script but it doesn't work. I'm wondering about $path. How would the script know to go anywhere to get anything since it doesn't link to any website? Any ideas how to make it work? Thanks Quote Link to comment Share on other sites More sharing options...
Stew_822 Posted February 15, 2015 Share Posted February 15, 2015 G'day mate Good questions are asked by first defining what you want to do. To answer your question as you put it, the $path variable doesn't know how to go anywhere since it is simply a string (which is just a sequence of characters). You haven't told it to do anything, so it isn't going to do anything, which makes logical sense. If you let us know what you're trying to achieve, then I don't mind spending a few minutes helping you get there. Cheers, Stewart Quote Link to comment Share on other sites More sharing options...
peterhuynh Posted February 15, 2015 Author Share Posted February 15, 2015 G'day mate Good questions are asked by first defining what you want to do. To answer your question as you put it, the $path variable doesn't know how to go anywhere since it is simply a string (which is just a sequence of characters). You haven't told it to do anything, so it isn't going to do anything, which makes logical sense. If you let us know what you're trying to achieve, then I don't mind spending a few minutes helping you get there. Cheers, Stewart Thank you. The script is supposed to execute a buy order at a bitcoin exchange. This is the example given to me by the exchange. Quote Link to comment Share on other sites More sharing options...
Stew_822 Posted February 16, 2015 Share Posted February 16, 2015 Ah ok - I'm afraid I can't help you any further with that, I have no experience with bitcoins. I imagine you would need to use a function to send a message to the server, wait for the the server to respond, and then act based on the server's response. Quote Link to comment Share on other sites More sharing options...
kicken Posted February 16, 2015 Share Posted February 16, 2015 That code is just an example of how to generate a signature for the API request. There will be more code necessary to actually perform the request. Keep looking over their examples or ask their support for the rest of the code. Quote Link to comment Share on other sites More sharing options...
grissom Posted February 17, 2015 Share Posted February 17, 2015 Kicken is right. So far, all you've done is built up some strings which will need to be "sent" somewhere, somehow. So there will have to be some more lines of code needed to do that. Kicken's suggestion to look over their examples or to ask their support is excellent. Quote Link to comment 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.