1

How can I execute a linux shell command on webpage button click or keyboard keypress with NodeJs and PHP?

Thanks

1 Answer 1

2

I did not understand well. Do you want to click on a button and that nodejs executes a command? If yes, this is the nodejs part

var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { sys.puts(stdout) }
exec("ls", puts); // Command

on the button you'll assign an ajax call onclick that makes a request to nodejs.

Source: http://www.dzone.com/snippets/execute-unix-command-nodejs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.