Jump to content

How does $path variable know to go anywhere?


peterhuynh

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.