How to use HD-WALLET-DERIVE in .php file?
I want to use commands from the hd-wallet-derive command tool in my website.
For example I run this in Ubuntu terminal and it works fine:
$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c --path=m/1 --cols=all --includeroot --numderive=3
But how can I use this code in my PHP file and get output?
For example if I click on a button in my PHP page, the below command run?
php ubuntu
add a comment |
I want to use commands from the hd-wallet-derive command tool in my website.
For example I run this in Ubuntu terminal and it works fine:
$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c --path=m/1 --cols=all --includeroot --numderive=3
But how can I use this code in my PHP file and get output?
For example if I click on a button in my PHP page, the below command run?
php ubuntu
please specify what works fine means. Does this include providing some output, or you need to just run those commands?
– YakovL
Nov 25 '18 at 9:25
When I use the command that I wrote upper in ubuntu terminal, It's gives me output. so how can I receive same output in .php file? how can I use -g in .php file and get the output?
– FreeJoyMan
Nov 25 '18 at 15:00
You can use theexec
function to run the terminal command from your php code. php.net/manual/en/function.exec.php
– Valerian Pereira
Nov 25 '18 at 15:57
Links in the comments to stackoverflow.com/q/6805963/3995261 may be helpful (the short answer seems to be – it's not possible viainclude
). The script you linked usesgetopt
so one question essentially is – how can you pass options to the script that usesgetopt
. May be the approach Valerian has suggested is the only option
– YakovL
Nov 25 '18 at 18:23
thank u guys, when I create a .php file and copy this code in it '<?php echo exec('whoami'); ' it's give me output in mozila. but when I use for example './hd-wallet-derive -g ' it dose not show any result? it require root acces? u give it root access? or any idea to excute this command in .php?
– FreeJoyMan
Nov 26 '18 at 9:33
add a comment |
I want to use commands from the hd-wallet-derive command tool in my website.
For example I run this in Ubuntu terminal and it works fine:
$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c --path=m/1 --cols=all --includeroot --numderive=3
But how can I use this code in my PHP file and get output?
For example if I click on a button in my PHP page, the below command run?
php ubuntu
I want to use commands from the hd-wallet-derive command tool in my website.
For example I run this in Ubuntu terminal and it works fine:
$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c --path=m/1 --cols=all --includeroot --numderive=3
But how can I use this code in my PHP file and get output?
For example if I click on a button in my PHP page, the below command run?
php ubuntu
php ubuntu
edited Nov 25 '18 at 15:06
FreeJoyMan
asked Nov 24 '18 at 20:54
FreeJoyManFreeJoyMan
11
11
please specify what works fine means. Does this include providing some output, or you need to just run those commands?
– YakovL
Nov 25 '18 at 9:25
When I use the command that I wrote upper in ubuntu terminal, It's gives me output. so how can I receive same output in .php file? how can I use -g in .php file and get the output?
– FreeJoyMan
Nov 25 '18 at 15:00
You can use theexec
function to run the terminal command from your php code. php.net/manual/en/function.exec.php
– Valerian Pereira
Nov 25 '18 at 15:57
Links in the comments to stackoverflow.com/q/6805963/3995261 may be helpful (the short answer seems to be – it's not possible viainclude
). The script you linked usesgetopt
so one question essentially is – how can you pass options to the script that usesgetopt
. May be the approach Valerian has suggested is the only option
– YakovL
Nov 25 '18 at 18:23
thank u guys, when I create a .php file and copy this code in it '<?php echo exec('whoami'); ' it's give me output in mozila. but when I use for example './hd-wallet-derive -g ' it dose not show any result? it require root acces? u give it root access? or any idea to excute this command in .php?
– FreeJoyMan
Nov 26 '18 at 9:33
add a comment |
please specify what works fine means. Does this include providing some output, or you need to just run those commands?
– YakovL
Nov 25 '18 at 9:25
When I use the command that I wrote upper in ubuntu terminal, It's gives me output. so how can I receive same output in .php file? how can I use -g in .php file and get the output?
– FreeJoyMan
Nov 25 '18 at 15:00
You can use theexec
function to run the terminal command from your php code. php.net/manual/en/function.exec.php
– Valerian Pereira
Nov 25 '18 at 15:57
Links in the comments to stackoverflow.com/q/6805963/3995261 may be helpful (the short answer seems to be – it's not possible viainclude
). The script you linked usesgetopt
so one question essentially is – how can you pass options to the script that usesgetopt
. May be the approach Valerian has suggested is the only option
– YakovL
Nov 25 '18 at 18:23
thank u guys, when I create a .php file and copy this code in it '<?php echo exec('whoami'); ' it's give me output in mozila. but when I use for example './hd-wallet-derive -g ' it dose not show any result? it require root acces? u give it root access? or any idea to excute this command in .php?
– FreeJoyMan
Nov 26 '18 at 9:33
please specify what works fine means. Does this include providing some output, or you need to just run those commands?
– YakovL
Nov 25 '18 at 9:25
please specify what works fine means. Does this include providing some output, or you need to just run those commands?
– YakovL
Nov 25 '18 at 9:25
When I use the command that I wrote upper in ubuntu terminal, It's gives me output. so how can I receive same output in .php file? how can I use -g in .php file and get the output?
– FreeJoyMan
Nov 25 '18 at 15:00
When I use the command that I wrote upper in ubuntu terminal, It's gives me output. so how can I receive same output in .php file? how can I use -g in .php file and get the output?
– FreeJoyMan
Nov 25 '18 at 15:00
You can use the
exec
function to run the terminal command from your php code. php.net/manual/en/function.exec.php– Valerian Pereira
Nov 25 '18 at 15:57
You can use the
exec
function to run the terminal command from your php code. php.net/manual/en/function.exec.php– Valerian Pereira
Nov 25 '18 at 15:57
Links in the comments to stackoverflow.com/q/6805963/3995261 may be helpful (the short answer seems to be – it's not possible via
include
). The script you linked uses getopt
so one question essentially is – how can you pass options to the script that uses getopt
. May be the approach Valerian has suggested is the only option– YakovL
Nov 25 '18 at 18:23
Links in the comments to stackoverflow.com/q/6805963/3995261 may be helpful (the short answer seems to be – it's not possible via
include
). The script you linked uses getopt
so one question essentially is – how can you pass options to the script that uses getopt
. May be the approach Valerian has suggested is the only option– YakovL
Nov 25 '18 at 18:23
thank u guys, when I create a .php file and copy this code in it '<?php echo exec('whoami'); ' it's give me output in mozila. but when I use for example './hd-wallet-derive -g ' it dose not show any result? it require root acces? u give it root access? or any idea to excute this command in .php?
– FreeJoyMan
Nov 26 '18 at 9:33
thank u guys, when I create a .php file and copy this code in it '<?php echo exec('whoami'); ' it's give me output in mozila. but when I use for example './hd-wallet-derive -g ' it dose not show any result? it require root acces? u give it root access? or any idea to excute this command in .php?
– FreeJoyMan
Nov 26 '18 at 9:33
add a comment |
1 Answer
1
active
oldest
votes
hd-wallet-derive is sending usage info to stderr, not stdout. To capture that, you could run the command as eg: ./hd-wallet-derive -g 2>&1
More to your question though, there is an option --outfile= to write report output to a given file. In a web app, you should specify a unique filename for the user. Further, you can specify what type of report output you want using the --format flag.
Usage info is here:
https://github.com/dan-da/hd-wallet-derive#usage
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462276%2fhow-to-use-hd-wallet-derive-in-php-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
hd-wallet-derive is sending usage info to stderr, not stdout. To capture that, you could run the command as eg: ./hd-wallet-derive -g 2>&1
More to your question though, there is an option --outfile= to write report output to a given file. In a web app, you should specify a unique filename for the user. Further, you can specify what type of report output you want using the --format flag.
Usage info is here:
https://github.com/dan-da/hd-wallet-derive#usage
add a comment |
hd-wallet-derive is sending usage info to stderr, not stdout. To capture that, you could run the command as eg: ./hd-wallet-derive -g 2>&1
More to your question though, there is an option --outfile= to write report output to a given file. In a web app, you should specify a unique filename for the user. Further, you can specify what type of report output you want using the --format flag.
Usage info is here:
https://github.com/dan-da/hd-wallet-derive#usage
add a comment |
hd-wallet-derive is sending usage info to stderr, not stdout. To capture that, you could run the command as eg: ./hd-wallet-derive -g 2>&1
More to your question though, there is an option --outfile= to write report output to a given file. In a web app, you should specify a unique filename for the user. Further, you can specify what type of report output you want using the --format flag.
Usage info is here:
https://github.com/dan-da/hd-wallet-derive#usage
hd-wallet-derive is sending usage info to stderr, not stdout. To capture that, you could run the command as eg: ./hd-wallet-derive -g 2>&1
More to your question though, there is an option --outfile= to write report output to a given file. In a web app, you should specify a unique filename for the user. Further, you can specify what type of report output you want using the --format flag.
Usage info is here:
https://github.com/dan-da/hd-wallet-derive#usage
answered Dec 3 '18 at 13:59
dandadanda
133
133
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462276%2fhow-to-use-hd-wallet-derive-in-php-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
please specify what works fine means. Does this include providing some output, or you need to just run those commands?
– YakovL
Nov 25 '18 at 9:25
When I use the command that I wrote upper in ubuntu terminal, It's gives me output. so how can I receive same output in .php file? how can I use -g in .php file and get the output?
– FreeJoyMan
Nov 25 '18 at 15:00
You can use the
exec
function to run the terminal command from your php code. php.net/manual/en/function.exec.php– Valerian Pereira
Nov 25 '18 at 15:57
Links in the comments to stackoverflow.com/q/6805963/3995261 may be helpful (the short answer seems to be – it's not possible via
include
). The script you linked usesgetopt
so one question essentially is – how can you pass options to the script that usesgetopt
. May be the approach Valerian has suggested is the only option– YakovL
Nov 25 '18 at 18:23
thank u guys, when I create a .php file and copy this code in it '<?php echo exec('whoami'); ' it's give me output in mozila. but when I use for example './hd-wallet-derive -g ' it dose not show any result? it require root acces? u give it root access? or any idea to excute this command in .php?
– FreeJoyMan
Nov 26 '18 at 9:33